]> git.ipfire.org Git - thirdparty/git.git/commitdiff
filter-branch: drop $_x40 glob
authorJeff King <peff@peff.net>
Wed, 10 Mar 2021 17:07:37 +0000 (12:07 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 Mar 2021 22:16:58 +0000 (14:16 -0800)
When checking whether a commit was rewritten to a single object id, we
use a glob that insists on a 40-hex result. This works for sha1, but
fails t7003 when run with GIT_TEST_DEFAULT_HASH=sha256.

Since the previous commit simplified the case statement here, we only
have two arms: an empty string or a single object id. We can just loosen
our glob to match anything, and still distinguish those cases (we lose
the ability to notice bogus input, but that's not a problem; we are the
one who wrote the map in the first place, and anyway update-ref will
complain loudly if the input isn't a valid hash).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-filter-branch.sh

index a1e80bd55208079115b4d40f60820ae6890a5a1d..cb893728136be39b2cb0042feb55d6377e870659 100755 (executable)
@@ -498,8 +498,6 @@ fi
 
 # Finally update the refs
 
-_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"
 echo
 while read ref
 do
@@ -519,7 +517,7 @@ do
                git update-ref -m "filter-branch: delete" -d "$ref" $sha1 ||
                        die "Could not delete $ref"
        ;;
-       $_x40)
+       *)
                echo "Ref '$ref' was rewritten"
                if ! git update-ref -m "filter-branch: rewrite" \
                                        "$ref" $rewritten $sha1 2>/dev/null; then
@@ -533,9 +531,6 @@ do
                        fi
                fi
        ;;
-       *)
-               die "BUG: multiple ancestors in map file?"
-       ;;
        esac
        git update-ref -m "filter-branch: backup" "$orig_namespace$ref" $sha1 ||
                 exit