]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t7003-filter-branch.sh
Merge branch 'mh/maint-http-proxy-fix'
[git.git] / t / t7003-filter-branch.sh
index bc6e2ddb19093fbdc9e4f94cbec71d369f0251ed..868babc4b2350526192a8df53f6cbec3f81c644e 100755 (executable)
@@ -41,7 +41,9 @@ test_expect_success 'rewrite, renaming a specific file' '
 '
 
 test_expect_success 'test that the file was renamed' '
-       test d = $(git show HEAD:doh)
+       test d = $(git show HEAD:doh) &&
+       test -f doh &&
+       test d = $(cat doh)
 '
 
 git tag oldD HEAD~4
@@ -112,7 +114,7 @@ test_expect_success 'use index-filter to move into a subdirectory' '
 
 test_expect_success 'stops when msg filter fails' '
        old=$(git rev-parse HEAD) &&
-       ! git-filter-branch -f --msg-filter false &&
+       ! git-filter-branch -f --msg-filter false HEAD &&
        test $old = $(git rev-parse HEAD) &&
        rm -rf .git-rewrite
 '
@@ -138,13 +140,7 @@ test_expect_success "remove a certain author's commits" '
        git-filter-branch -f --commit-filter "\
                if [ \"\$GIT_AUTHOR_NAME\" = \"B V Uips\" ];\
                then\
-                       shift;\
-                       while [ -n \"\$1\" ];\
-                       do\
-                               shift;\
-                               echo \"\$1\";\
-                               shift;\
-                       done;\
+                       skip_commit \"\$@\";
                else\
                        git commit-tree \"\$@\";\
                fi" removed-author &&
@@ -159,4 +155,28 @@ test_expect_success 'barf on invalid name' '
        ! git filter-branch -f HEAD^
 '
 
+test_expect_success '"map" works in commit filter' '
+       git filter-branch -f --commit-filter "\
+               parent=\$(git rev-parse \$GIT_COMMIT^) &&
+               mapped=\$(map \$parent) &&
+               actual=\$(echo \"\$@\" | sed \"s/^.*-p //\") &&
+               test \$mapped = \$actual &&
+               git commit-tree \"\$@\";" master~2..master &&
+       git rev-parse --verify master
+'
+
+test_expect_success 'Name needing quotes' '
+
+       git checkout -b rerere A &&
+       mkdir foo &&
+       name="れれれ" &&
+       >foo/$name &&
+       git add foo &&
+       git commit -m "Adding a file" &&
+       git filter-branch --tree-filter "rm -fr foo" &&
+       ! git ls-files --error-unmatch "foo/$name" &&
+       test $(git rev-parse --verify rerere) != $(git rev-parse --verify A)
+
+'
+
 test_done