]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t7003-filter-branch.sh
Merge branch 'en/ort-perf-batch-9'
[thirdparty/git.git] / t / t7003-filter-branch.sh
index 1c556950346f0cfcf145991cea6fe34f37a300b6..1349e5b2321c802faf50aed2af7d3cfee7c27974 100755 (executable)
@@ -506,4 +506,35 @@ test_expect_success 'rewrite repository including refs that point at non-commit
        ! fgrep fatal filter-output
 '
 
+test_expect_success 'filter-branch handles ref deletion' '
+       git switch --orphan empty-commit &&
+       git commit --allow-empty -m "empty commit" &&
+       git tag empty &&
+       git branch to-delete &&
+       git filter-branch -f --prune-empty to-delete >out 2>&1 &&
+       grep "to-delete.*was deleted" out &&
+       test_must_fail git rev-parse --verify to-delete
+'
+
+test_expect_success 'filter-branch handles ref rewrite' '
+       git checkout empty &&
+       test_commit to-drop &&
+       git branch rewrite &&
+       git filter-branch -f \
+               --index-filter "git rm --ignore-unmatch --cached to-drop.t" \
+                rewrite >out 2>&1 &&
+       grep "rewrite.*was rewritten" out &&
+       ! grep -i warning out &&
+       git diff-tree empty rewrite
+'
+
+test_expect_success 'filter-branch handles ancestor rewrite' '
+       test_commit to-exclude &&
+       git branch ancestor &&
+       git filter-branch -f ancestor -- :^to-exclude.t >out 2>&1 &&
+       grep "ancestor.*was rewritten" out &&
+       ! grep -i warning out &&
+       git diff-tree HEAD^ ancestor
+'
+
 test_done