Skip to content

Commit 42efa12

Browse files
peffgitster
authored andcommitted
filter-branch: drop $_x40 glob
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 98fe9e6 commit 42efa12

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

git-filter-branch.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,6 @@ fi
498498

499499
# Finally update the refs
500500

501-
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
502-
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
503501
echo
504502
while read ref
505503
do
@@ -519,7 +517,7 @@ do
519517
git update-ref -m "filter-branch: delete" -d "$ref" $sha1 ||
520518
die "Could not delete $ref"
521519
;;
522-
$_x40)
520+
*)
523521
echo "Ref '$ref' was rewritten"
524522
if ! git update-ref -m "filter-branch: rewrite" \
525523
"$ref" $rewritten $sha1 2>/dev/null; then
@@ -533,9 +531,6 @@ do
533531
fi
534532
fi
535533
;;
536-
*)
537-
die "BUG: multiple ancestors in map file?"
538-
;;
539534
esac
540535
git update-ref -m "filter-branch: backup" "$orig_namespace$ref" $sha1 ||
541536
exit

0 commit comments

Comments
 (0)