summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-10-30 20:04:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-10-30 20:04:24 (GMT)
commitf9c0e741a9f0e303b19bc0c0bad6bcbac63c4ab2 (patch)
treeccd7c4c6e953147563a585259242009c2336e5a4 /contrib
parentc8b7c0272aa67ce0788be51e3f0edb5f2279abb8 (diff)
parente37eae0c1e13cb418947383f7c803d9463bfa3d7 (diff)
downloadgit-f9c0e741a9f0e303b19bc0c0bad6bcbac63c4ab2.zip
git-f9c0e741a9f0e303b19bc0c0bad6bcbac63c4ab2.tar.gz
git-f9c0e741a9f0e303b19bc0c0bad6bcbac63c4ab2.tar.bz2
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
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/git-resurrect.sh13
1 files changed, 6 insertions, 7 deletions
diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh
index 8c171dd..d843df3 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=