diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-10-30 13:04:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-10-30 13:04:24 -0700 |
commit | f9c0e741a9f0e303b19bc0c0bad6bcbac63c4ab2 (patch) | |
tree | ccd7c4c6e953147563a585259242009c2336e5a4 | |
parent | Merge branch 'cm/t7xxx-cleanup' (diff) | |
parent | contrib/git-resurrect.sh: use hash-agnostic OID pattern (diff) | |
download | tgif-f9c0e741a9f0e303b19bc0c0bad6bcbac63c4ab2.tar.xz |
Merge branch 'dl/resurrect-update-for-sha256'
"git resurrect" script (in contrib/) learned that the object names
may be longer than 40-hex depending on the hash function in use.
* dl/resurrect-update-for-sha256:
contrib/git-resurrect.sh: use hash-agnostic OID pattern
contrib/git-resurrect.sh: indent with tabs
-rwxr-xr-x | contrib/git-resurrect.sh | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh index 8c171dd959..d843df3afd 100755 --- a/contrib/git-resurrect.sh +++ b/contrib/git-resurrect.sh @@ -27,7 +27,7 @@ n,dry-run don't recreate the branch" search_reflog () { sed -ne 's~^\([^ ]*\) .* checkout: moving from '"$1"' .*~\1~p' \ - < "$GIT_DIR"/logs/HEAD + < "$GIT_DIR"/logs/HEAD } search_reflog_merges () { @@ -37,19 +37,18 @@ search_reflog_merges () { ) } -_x40="[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]" -_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" +oid_pattern=$(git hash-object --stdin </dev/null | sed -e 's/./[0-9a-f]/g') search_merges () { - git rev-list --all --grep="Merge branch '$1'" \ - --pretty=tformat:"%P %s" | - sed -ne "/^$_x40 \($_x40\) Merge .*/ {s//\1/p;$early_exit}" + git rev-list --all --grep="Merge branch '$1'" \ + --pretty=tformat:"%P %s" | + sed -ne "/^$oid_pattern \($oid_pattern\) Merge .*/ {s//\1/p;$early_exit}" } search_merge_targets () { git rev-list --all --grep="Merge branch '[^']*' into $branch\$" \ --pretty=tformat:"%H %s" --all | - sed -ne "/^\($_x40\) Merge .*/ {s//\1/p;$early_exit} " + sed -ne "/^\($oid_pattern\) Merge .*/ {s//\1/p;$early_exit} " } dry_run= |