6e2be5be0e55838b1c9e1f7426b3ba1cdbad1395
1 #!/bin/sh
3 test_description='git-filter-branch'
4 . ./test-lib.sh
6 make_commit () {
7 lower=$(echo $1 | tr A-Z a-z)
8 echo $lower > $lower
9 git add $lower
10 test_tick
11 git commit -m $1
12 git tag $1
13 }
15 test_expect_success 'setup' '
16 make_commit A
17 make_commit B
18 git checkout -b branch B
19 make_commit D
20 make_commit E
21 git checkout master
22 make_commit C
23 git checkout branch
24 git merge C
25 git tag F
26 make_commit G
27 make_commit H
28 '
30 H=$(git-rev-parse H)
32 test_expect_success 'rewrite identically' '
33 git-filter-branch H2
34 '
36 test_expect_success 'result is really identical' '
37 test $H = $(git-rev-parse H2)
38 '
40 test_expect_success 'rewrite, renaming a specific file' '
41 git-filter-branch --tree-filter "mv d doh || :" H3
42 '
44 test_expect_success 'test that the file was renamed' '
45 test d = $(git show H3:doh)
46 '
48 git tag oldD H3~4
49 test_expect_success 'rewrite one branch, keeping a side branch' '
50 git-filter-branch --tree-filter "mv b boh || :" -k D -s oldD modD
51 '
53 test_expect_success 'common ancestor is still common (unchanged)' '
54 test "$(git-merge-base modD D)" = "$(git-rev-parse B)"
55 '
57 test_done