marcoabreu edited a comment on issue #12615: Correct PR branch detection in code coverage URL: https://github.com/apache/incubator-mxnet/pull/12615#issuecomment-423259538 Ah! I found something: These two runs reference the same commit https://github.com/apache/incubator-mxnet/pull/12615/commits/d724c8cbffb90bb4ba64397eadaa1ef667f88ccc. But the SCM output is different: http://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/incubator-mxnet/detail/PR-12615/2/pipeline/980/ ``` Cloning the remote Git repository Cloning with configured refspecs honoured and without tags Cloning repository https://github.com/apache/incubator-mxnet.git > git init /home/jenkins_slave/workspace/ut-clojure-cpu # timeout=10 Fetching upstream changes from https://github.com/apache/incubator-mxnet.git > git --version # timeout=10 using GIT_ASKPASS to set credentials > git fetch --no-tags --progress https://github.com/apache/incubator-mxnet.git +refs/pull/12615/head:refs/remotes/origin/PR-12615 +refs/heads/master:refs/remotes/origin/master > git config remote.origin.url https://github.com/apache/incubator-mxnet.git # timeout=10 > git config --add remote.origin.fetch +refs/pull/12615/head:refs/remotes/origin/PR-12615 # timeout=10 > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master # timeout=10 > git config remote.origin.url https://github.com/apache/incubator-mxnet.git # timeout=10 Fetching without tags Fetching upstream changes from https://github.com/apache/incubator-mxnet.git using GIT_ASKPASS to set credentials > git fetch --no-tags --progress https://github.com/apache/incubator-mxnet.git +refs/pull/12615/head:refs/remotes/origin/PR-12615 +refs/heads/master:refs/remotes/origin/master Merging remotes/origin/master commit 7797584450186d36e52c902c3b606f4b4676e0a3 into PR head commit d724c8cbffb90bb4ba64397eadaa1ef667f88ccc > git config core.sparsecheckout # timeout=10 > git checkout -f d724c8cbffb90bb4ba64397eadaa1ef667f88ccc > git merge 7797584450186d36e52c902c3b606f4b4676e0a3 # timeout=10 > git rev-parse HEAD^{commit} # timeout=10 Merge succeeded, producing d724c8cbffb90bb4ba64397eadaa1ef667f88ccc Checking out Revision d724c8cbffb90bb4ba64397eadaa1ef667f88ccc (PR-12615) > git config core.sparsecheckout # timeout=10 > git checkout -f d724c8cbffb90bb4ba64397eadaa1ef667f88ccc Commit message: "Always use latest commit" ``` http://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/incubator-mxnet/detail/PR-12615/3/pipeline/980 ``` Cloning the remote Git repository Cloning with configured refspecs honoured and without tags Cloning repository https://github.com/apache/incubator-mxnet.git > git init /home/jenkins_slave/workspace/ut-clojure-cpu # timeout=10 Fetching upstream changes from https://github.com/apache/incubator-mxnet.git > git --version # timeout=10 using GIT_ASKPASS to set credentials > git fetch --no-tags --progress https://github.com/apache/incubator-mxnet.git +refs/pull/12615/head:refs/remotes/origin/PR-12615 +refs/heads/master:refs/remotes/origin/master > git config remote.origin.url https://github.com/apache/incubator-mxnet.git # timeout=10 > git config --add remote.origin.fetch +refs/pull/12615/head:refs/remotes/origin/PR-12615 # timeout=10 > git config --add remote.origin.fetch +refs/heads/master:refs/remotes/origin/master # timeout=10 > git config remote.origin.url https://github.com/apache/incubator-mxnet.git # timeout=10 Fetching without tags Fetching upstream changes from https://github.com/apache/incubator-mxnet.git using GIT_ASKPASS to set credentials > git fetch --no-tags --progress https://github.com/apache/incubator-mxnet.git +refs/pull/12615/head:refs/remotes/origin/PR-12615 +refs/heads/master:refs/remotes/origin/master Merging remotes/origin/master commit 3401e6e116615730882b9bede5b6abbb51b9a547 into PR head commit d724c8cbffb90bb4ba64397eadaa1ef667f88ccc > git config core.sparsecheckout # timeout=10 > git checkout -f d724c8cbffb90bb4ba64397eadaa1ef667f88ccc > git merge 3401e6e116615730882b9bede5b6abbb51b9a547 # timeout=10 > git rev-parse HEAD^{commit} # timeout=10 Merge succeeded, producing 2aeb7ad9247d0aded866fb8990572addee451c39 Checking out Revision 2aeb7ad9247d0aded866fb8990572addee451c39 (PR-12615) > git config core.sparsecheckout # timeout=10 > git checkout -f 2aeb7ad9247d0aded866fb8990572addee451c39 Commit message: "Merge commit '3401e6e116615730882b9bede5b6abbb51b9a547' into HEAD" ``` The key difference here is that during the first run, my PRs base was the same as the HEAD of the master branch: https://github.com/apache/incubator-mxnet/commit/7797584450186d36e52c902c3b606f4b4676e0a3 and my branch was 2 commits ahead and 0 behind. Thus, no merge was necessary but a simple fast-forward was applied. During the second run, https://github.com/apache/incubator-mxnet/commit/3401e6e116615730882b9bede5b6abbb51b9a547 was pushed to the master branch and thus my branch was 2 commits ahead and 1 behind. This requires a merge commit. This means that I don't have to make this logic conditional on whether the current run is part of a PR or a regular branch but rather parse the current contexts' HEAD and check whether it matches "Merge commit '$HASH$' into HEAD".
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
