File tree 1 file changed +27
-3
lines changed
1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -555,14 +555,38 @@ os::build::commit_range() {
555
555
fi
556
556
557
557
local base
558
- base=" $( git merge-base ${remote} /pr/ $1 $2 ) "
558
+ base=" $( git merge-base ${target} $2 ) "
559
559
if [[ $? -ne 0 ]]; then
560
560
echo " Branch has no common commits with $2 " 1>&2
561
561
exit 1
562
562
fi
563
563
if [[ " ${base} " == " ${target} " ]]; then
564
- echo " Branch has already been merged to upstream master, use explicit range instead" 1>&2
565
- exit 1
564
+
565
+ # DO NOT TRUST THIS CODE
566
+ merged=" $( git rev-list --reverse ${target} ..$2 --ancestry-path | head -1) "
567
+ if [[ -z " ${merged} " ]]; then
568
+ echo " Unable to find the commit that merged ${remote} /pr/$1 " 1>&2
569
+ exit 1
570
+ fi
571
+ # if [[ $? -ne 0 ]]; then
572
+ # echo "Unable to find the merge commit for $1: ${merged}" 1>&2
573
+ # exit 1
574
+ # fi
575
+ echo " ++ pr/$1 appears to have merged at ${merged} " 1>&2
576
+ leftparent=" $( git rev-list --parents -n 1 ${merged} | cut -f2 -d ' ' ) "
577
+ if [[ $? -ne 0 ]]; then
578
+ echo " Unable to find the left-parent for the merge of for $1 " 1>&2
579
+ exit 1
580
+ fi
581
+ base=" $( git merge-base ${target} ${leftparent} ) "
582
+ if [[ $? -ne 0 ]]; then
583
+ echo " Unable to find the common commit between ${leftparent} and $1 " 1>&2
584
+ exit 1
585
+ fi
586
+ echo " ${base} ..${target} "
587
+ exit 0
588
+ # echo "Branch has already been merged to upstream master, use explicit range instead" 1>&2
589
+ # exit 1
566
590
fi
567
591
568
592
echo " ${base} ...${target} "
You can’t perform that action at this time.
0 commit comments