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
Родитель c8b7c0272a e37eae0c1e
Коммит f9c0e741a9
1 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -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=