1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-27 06:26:13 +02:00

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
This commit is contained in:
Junio C Hamano 2020-10-30 13:04:24 -07:00
commit f9c0e741a9

View File

@ -27,7 +27,7 @@ n,dry-run don't recreate the branch"
search_reflog () { search_reflog () {
sed -ne 's~^\([^ ]*\) .* checkout: moving from '"$1"' .*~\1~p' \ sed -ne 's~^\([^ ]*\) .* checkout: moving from '"$1"' .*~\1~p' \
< "$GIT_DIR"/logs/HEAD < "$GIT_DIR"/logs/HEAD
} }
search_reflog_merges () { 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]" oid_pattern=$(git hash-object --stdin </dev/null | sed -e 's/./[0-9a-f]/g')
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
search_merges () { search_merges () {
git rev-list --all --grep="Merge branch '$1'" \ git rev-list --all --grep="Merge branch '$1'" \
--pretty=tformat:"%P %s" | --pretty=tformat:"%P %s" |
sed -ne "/^$_x40 \($_x40\) Merge .*/ {s//\1/p;$early_exit}" sed -ne "/^$oid_pattern \($oid_pattern\) Merge .*/ {s//\1/p;$early_exit}"
} }
search_merge_targets () { search_merge_targets () {
git rev-list --all --grep="Merge branch '[^']*' into $branch\$" \ git rev-list --all --grep="Merge branch '[^']*' into $branch\$" \
--pretty=tformat:"%H %s" --all | --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= dry_run=