summaryrefslogtreecommitdiff
path: root/t/t7003-filter-branch.sh
diff options
context:
space:
mode:
authorYuki Kokubun <orga.chem.job@gmail.com>2018-03-25 16:54:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-25 17:12:27 (GMT)
commitf78ab355e7d91c70faf41ddad9577cffc3b4ee60 (patch)
treeb0a7bb304abd2fd4c1d6163710eea8e2676ea428 /t/t7003-filter-branch.sh
parentd32eb83c1db7d0a8bb54fe743c6d1dd674d372c5 (diff)
downloadgit-f78ab355e7d91c70faf41ddad9577cffc3b4ee60.zip
git-f78ab355e7d91c70faf41ddad9577cffc3b4ee60.tar.gz
git-f78ab355e7d91c70faf41ddad9577cffc3b4ee60.tar.bz2
filter-branch: fix errors caused by refs that point at non-committish
"git filter-branch -- --all" prints error messages when processing refs that point at objects that are not committish. Such refs can be created by "git replace" with trees or blobs. And also "git tag" with trees or blobs can create such refs. Filter these problematic refs out early, before they are seen by the logic to see which refs have been modified and which have been left intact (which is where the unwanted error messages come from), and warn that these refs are left unwritten while doing so. Signed-off-by: Yuki Kokubun <orga.chem.job@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7003-filter-branch.sh')
-rwxr-xr-xt/t7003-filter-branch.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index 7cb6079..04f79f3 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -470,4 +470,18 @@ test_expect_success 'tree-filter deals with object name vs pathname ambiguity' '
git show HEAD:$ambiguous
'
+test_expect_success 'rewrite repository including refs that point at non-commit object' '
+ test_when_finished "git reset --hard original" &&
+ tree=$(git rev-parse HEAD^{tree}) &&
+ test_when_finished "git replace -d $tree" &&
+ echo A >new &&
+ git add new &&
+ new_tree=$(git write-tree) &&
+ git replace $tree $new_tree &&
+ git tag -a -m "tag to a tree" treetag $new_tree &&
+ git reset --hard HEAD &&
+ git filter-branch -f -- --all >filter-output 2>&1 &&
+ ! fgrep fatal filter-output
+'
+
test_done