Add git-filter-branch
[git/jrn.git] / t / t7003-filter-branch.sh
blob9a4dae44f2038d8442a37b4bce4161a2cc578e64
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 git commit -m $1
11 git tag $1
14 test_expect_success 'setup' '
15 make_commit A
16 make_commit B
17 git checkout -b branch B
18 make_commit D
19 make_commit E
20 git checkout master
21 make_commit C
22 git checkout branch
23 git merge C
24 git tag F
25 make_commit G
26 make_commit H
29 H=$(git-rev-parse H)
31 test_expect_success 'rewrite identically' '
32 git-filter-branch H2
35 test_expect_success 'result is really identical' '
36 test $H = $(git-rev-parse H2)
39 test_expect_success 'rewrite, renaming a specific file' '
40 git-filter-branch --tree-filter "mv d doh || :" H3
43 test_expect_success 'test that the file was renamed' '
44 test d = $(git show H3:doh)
47 test_done