aboutsummaryrefslogtreecommitdiff
path: root/t/t7003-filter-branch.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-06-05 16:58:13 +0100
committerJunio C Hamano <gitster@pobox.com>2007-06-06 12:49:16 -0700
commit9840906026be807d0882f96396de3a3cdb9fb43e (patch)
treee9660a07d70a1ccb7804e275f106d9e3525330f1 /t/t7003-filter-branch.sh
parentc12764b8b7e004f84b1e685b76f2d662bee8e196 (diff)
downloadgit-9840906026be807d0882f96396de3a3cdb9fb43e.tar.gz
git-9840906026be807d0882f96396de3a3cdb9fb43e.tar.xz
filter-branch: fix behaviour of '-k'
The option '-k' says that the given commit and _all_ of its ancestors are kept as-is. However, if a to-be-rewritten commit branched from an ancestor of an ancestor of a commit given with '-k', filter-branch would fail. Example: A - B \ C If filter-branch was called with '-k B -s C', it would actually keep B (and A as its parent), but would rewrite C, and its parent. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7003-filter-branch.sh')
-rwxr-xr-xt/t7003-filter-branch.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index c82ff1d6e..6e2be5be0 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -45,4 +45,13 @@ test_expect_success 'test that the file was renamed' '
test d = $(git show H3:doh)
'
+git tag oldD H3~4
+test_expect_success 'rewrite one branch, keeping a side branch' '
+ git-filter-branch --tree-filter "mv b boh || :" -k D -s oldD modD
+'
+
+test_expect_success 'common ancestor is still common (unchanged)' '
+ test "$(git-merge-base modD D)" = "$(git-rev-parse B)"
+'
+
test_done