File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -528,10 +528,15 @@ function rp_getRemoteRepoHash() {
528
528
set -o pipefail
529
529
case " $type " in
530
530
git)
531
- cmd=(git ls-remote " $url " " $branch " )
532
- # grep to make sure we only return refs/heads/BRANCH and refs/tags/BRANCH in case there are
533
- # additional references to the branch/tag eg refs/heads/SOMETHINGELSE/master which can be the case
534
- hash=$( " ${cmd[@]} " 2> /dev/null | grep -P " \trefs/(heads|tags)/$branch " | cut -f1)
531
+ # when the remote repository uses an annotated git tag, the real commit is found by looking for the
532
+ # "tag^{}" reference, since the the tag ref will point to the tag object itself, instead of the tagged
533
+ # commit. See gitrevisions(7).
534
+ cmd=(git ls-remote " $url " " $branch " " $branch ^{}" )
535
+ # grep to make sure we only return refs/heads/BRANCH and refs/tags/BRANCH in case there are additional
536
+ # references to the branch/tag eg refs/heads/SOMETHINGELSE/master which can be the case.
537
+ # we grab the last match reported by grep, as tags that also have a tag^{} reference
538
+ # will be displayed after.
539
+ hash=$( " ${cmd[@]} " 2> /dev/null | grep -P " \trefs/(heads|tags)/$branch " | tail -n1 | cut -f1)
535
540
;;
536
541
svn)
537
542
cmd=(svn info -r" $commit " " $url " )
You can’t perform that action at this time.
0 commit comments