File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -49,19 +49,19 @@ $awk -v origin_name="$1" '
4949 $2 ~ /^[a-z0-9]{40}$/ {
5050 newref = $2
5151 # If the remote SHA is all zeroes, this is a new object to be
52- # pushed (likely a branch). Go backwards until we find a SHA on
53- # an origin branch.
52+ # pushed (likely a branch)...
5453 if ($4 ~ /^0{40}$/) {
5554 back = 0
56- cmd = ("git branch -r -l ' \' ' " origin_name "/*' \' ' --contains " \
57- newref "~" back)
58- while ((cmd | getline) == 0) {
59-
60- # Only look back at most 1000 commits, just in case...
61- if (back++ > 1000)
55+ # ... Go backwards until we find a SHA on an origin branch.
56+ # Stop trying after 1000 commits, just in case...
57+ for (back = 0; back < 1000; back++) {
58+ cmd = ("git branch -r -l ' \' ' " origin_name "/*' \' ' " \
59+ " --contains " newref "~" back)
60+ rv = (cmd | getline)
61+ close(cmd)
62+ if (rv > 0)
6263 break;
6364 }
64- close(cmd)
6565
6666 cmd = ("git rev-parse " newref "~" back)
6767 cmd | getline oldref
You can’t perform that action at this time.
0 commit comments