diff options
| author | Jim Porter | 2023-04-23 12:04:34 -0700 |
|---|---|---|
| committer | Jim Porter | 2023-04-23 12:07:08 -0700 |
| commit | e26dcc0e1441ded286b83eefb358d965748dd6db (patch) | |
| tree | a71b15094d1cf26363ada51d3f9f4e87d7dcc8ca /build-aux | |
| parent | 9914de503bd39b5a8b55a472d7cee6832a72e61d (diff) | |
| download | emacs-e26dcc0e1441ded286b83eefb358d965748dd6db.tar.gz emacs-e26dcc0e1441ded286b83eefb358d965748dd6db.zip | |
; Fix logic of Git pre-push hook when pushing a new branch
* build-aux/git-hooks/pre-push: Update the Git command to run on each
iteration.
Diffstat (limited to 'build-aux')
| -rwxr-xr-x | build-aux/git-hooks/pre-push | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/build-aux/git-hooks/pre-push b/build-aux/git-hooks/pre-push index adcf27d4a5d..65c96bfdec9 100755 --- a/build-aux/git-hooks/pre-push +++ b/build-aux/git-hooks/pre-push | |||
| @@ -49,19 +49,19 @@ $awk -v origin_name="$1" ' | |||
| 49 | $2 ~ /^[a-z0-9]{40}$/ { | 49 | $2 ~ /^[a-z0-9]{40}$/ { |
| 50 | newref = $2 | 50 | newref = $2 |
| 51 | # If the remote SHA is all zeroes, this is a new object to be | 51 | # 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 | 52 | # pushed (likely a branch)... |
| 53 | # an origin branch. | ||
| 54 | if ($4 ~ /^0{40}$/) { | 53 | if ($4 ~ /^0{40}$/) { |
| 55 | back = 0 | 54 | back = 0 |
| 56 | cmd = ("git branch -r -l '\''" origin_name "/*'\'' --contains " \ | 55 | # ... Go backwards until we find a SHA on an origin branch. |
| 57 | newref "~" back) | 56 | # Stop trying after 1000 commits, just in case... |
| 58 | while ((cmd | getline) == 0) { | 57 | for (back = 0; back < 1000; back++) { |
| 59 | 58 | cmd = ("git branch -r -l '\''" origin_name "/*'\''" \ | |
| 60 | # Only look back at most 1000 commits, just in case... | 59 | " --contains " newref "~" back) |
| 61 | if (back++ > 1000) | 60 | rv = (cmd | getline) |
| 61 | close(cmd) | ||
| 62 | if (rv > 0) | ||
| 62 | break; | 63 | break; |
| 63 | } | 64 | } |
| 64 | close(cmd) | ||
| 65 | 65 | ||
| 66 | cmd = ("git rev-parse " newref "~" back) | 66 | cmd = ("git rev-parse " newref "~" back) |
| 67 | cmd | getline oldref | 67 | cmd | getline oldref |