{"thread":{"id":"8839","subject":"[PATCH] filter-branch: add a test for the commit removal example","startedAt":"2007-07-03T16:50:19Z","lastAt":"2007-07-03T16:50:19Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46389","messageId":"Pine.LNX.4.64.0707031749480.4071@racer.site","threadId":"8839","inReplyTo":null,"subject":"[PATCH] filter-branch: add a test for the commit removal example","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-03T16:50:19Z","receivedAt":"2007-07-03T16:50:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nIn the man page, there is an example which describes how to remove\nsingle commits (although it keeps the changes which were not reverted\nin the next non-removed commit). Better make sure that it works as\nexpected.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/t7003-filter-branch.sh |   35 +++++++++++++++++++++++++++++++++++\n 1 files changed, 35 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh\nindex 21f9bc5..451ac86 100755\n--- a/t/t7003-filter-branch.sh\n+++ b/t/t7003-filter-branch.sh\n@@ -107,4 +107,39 @@ test_expect_success 'use index-filter to move into a subdirectory' '\n \t\t  mv \\$GIT_INDEX_FILE.new \\$GIT_INDEX_FILE\" directorymoved &&\n \ttest -z \"$(git diff HEAD directorymoved:newsubdir)\"'\n \n+test_expect_success 'author information is preserved' '\n+\t: > i &&\n+\tgit add i &&\n+\ttest_tick &&\n+\tGIT_AUTHOR_NAME=\"B V Uips\" git commit -m bvuips &&\n+\tgit-filter-branch --msg-filter \"cat; \\\n+\t\t\ttest \\$GIT_COMMIT = $(git rev-parse master) && \\\n+\t\t\techo Hallo\" \\\n+\t\tpreserved-author &&\n+\ttest 1 = $(git rev-list --author=\"B V Uips\" preserved-author | wc -l)\n+'\n+\n+test_expect_success \"remove a certain author's commits\" '\n+\techo i > i &&\n+\ttest_tick &&\n+\tgit commit -m i i &&\n+\tgit-filter-branch --commit-filter \"\\\n+\t\tif [ \\\"\\$GIT_AUTHOR_NAME\\\" = \\\"B V Uips\\\" ];\\\n+\t\tthen\\\n+\t\t\tshift;\\\n+\t\t\twhile [ -n \\\"\\$1\\\" ];\\\n+\t\t\tdo\\\n+\t\t\t\tshift;\\\n+\t\t\t\techo \\\"\\$1\\\";\\\n+\t\t\t\tshift;\\\n+\t\t\tdone;\\\n+\t\telse\\\n+\t\t\tgit commit-tree \\\"\\$@\\\";\\\n+\t\tfi\" removed-author &&\n+\tcnt1=$(git rev-list master | wc -l) &&\n+\tcnt2=$(git rev-list removed-author | wc -l) &&\n+\ttest $cnt1 -eq $(($cnt2 + 1)) &&\n+\ttest 0 = $(git rev-list --author=\"B V Uips\" removed-author | wc -l)\n+'\n+\n test_done\n-- \n1.5.3.rc0.2637.g1dd84-dirty\n"}]}