From fe6beab7e80565dac81125aa82521f7673905ebc Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 4 Dec 2008 17:08:48 -0800 Subject: Test that git-am does not lose -C/-p/--whitespace options These tests make sure that "git am" does not lose command line options specified when it was started, after it is interrupted by a patch that does not apply earlier in the series. Signed-off-by: Junio C Hamano --- t/t4252-am-options.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 t/t4252-am-options.sh (limited to 't/t4252-am-options.sh') diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh new file mode 100755 index 0000000000..1a1946dd97 --- /dev/null +++ b/t/t4252-am-options.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +test_description='git am not losing options' +. ./test-lib.sh + +tm="$TEST_DIRECTORY/t4252" + +test_expect_success setup ' + cp "$tm/file-1-0" file-1 && + cp "$tm/file-2-0" file-2 && + git add file-1 file-2 && + test_tick && + git commit -m initial && + git tag initial +' + +test_expect_success 'interrupted am --whitespace=fix' ' + rm -rf .git/rebase-apply && + git reset --hard initial && + test_must_fail git am --whitespace=fix "$tm"/am-test-1-? && + git am --skip && + grep 3 file-1 && + grep "^Six$" file-2 +' + +test_expect_success 'interrupted am -C1' ' + rm -rf .git/rebase-apply && + git reset --hard initial && + test_must_fail git am -C1 "$tm"/am-test-2-? && + git am --skip && + grep 3 file-1 && + grep "^Three$" file-2 +' + +test_expect_success 'interrupted am -p2' ' + rm -rf .git/rebase-apply && + git reset --hard initial && + test_must_fail git am -p2 "$tm"/am-test-3-? && + git am --skip && + grep 3 file-1 && + grep "^Three$" file-2 +' + +test_expect_success 'interrupted am -C1 -p2' ' + rm -rf .git/rebase-apply && + git reset --hard initial && + test_must_fail git am -p2 -C1 "$tm"/am-test-4-? && + cat .git/rebase-apply/apply_opt_extra && + git am --skip && + grep 3 file-1 && + grep "^Three$" file-2 +' + +test_done -- cgit v1.2.3 From 9b9f5a2258e6df611d2903d84fd8d41806ce0e00 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 5 Dec 2008 11:19:43 -0800 Subject: git-am: rename apply_opt_extra file to apply-opt All other state files use dash in their names, not underscores. Also, there is no reason to call this "extra". Drop it. Signed-off-by: Junio C Hamano --- t/t4252-am-options.sh | 1 - 1 file changed, 1 deletion(-) (limited to 't/t4252-am-options.sh') diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh index 1a1946dd97..3ab9e8e6e3 100755 --- a/t/t4252-am-options.sh +++ b/t/t4252-am-options.sh @@ -45,7 +45,6 @@ test_expect_success 'interrupted am -C1 -p2' ' rm -rf .git/rebase-apply && git reset --hard initial && test_must_fail git am -p2 -C1 "$tm"/am-test-4-? && - cat .git/rebase-apply/apply_opt_extra && git am --skip && grep 3 file-1 && grep "^Three$" file-2 -- cgit v1.2.3 From b47dfe9e9c86be97fc07c4c04e26a303730f76c6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 11 Jan 2009 22:21:48 -0800 Subject: git-am: add --directory= option Thanks to a200337 (git-am: propagate -C, -p options as well, 2008-12-04) and commits around it, "git am" is equipped to correctly propagate the command line flags such as -C/-p/-whitespace across a patch failure and restart. It is trivial to support --directory option now, resurrecting previous attempts by Kevin and Simon. Signed-off-by: Junio C Hamano --- t/t4252-am-options.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/t4252-am-options.sh') diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh index 3ab9e8e6e3..e91a6da0d5 100755 --- a/t/t4252-am-options.sh +++ b/t/t4252-am-options.sh @@ -50,4 +50,12 @@ test_expect_success 'interrupted am -C1 -p2' ' grep "^Three$" file-2 ' +test_expect_success 'interrupted am --directory="frotz nitfol"' ' + rm -rf .git/rebase-apply && + git reset --hard initial && + test_must_fail git am --directory="frotz nitfol" "$tm"/am-test-5-? && + git am --skip && + grep One "frotz nitfol/file-5" +' + test_done -- cgit v1.2.3 From 17f26a9ee3298dfa0a1df7cd4e5f5f32342e5f62 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 14 Jan 2009 16:29:59 -0800 Subject: git-am: fix shell quoting Noticed by Stephan Beyer; the new test is mine. Signed-off-by: Junio C Hamano --- t/t4252-am-options.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/t4252-am-options.sh') diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh index e91a6da0d5..5fdd188582 100755 --- a/t/t4252-am-options.sh +++ b/t/t4252-am-options.sh @@ -58,4 +58,12 @@ test_expect_success 'interrupted am --directory="frotz nitfol"' ' grep One "frotz nitfol/file-5" ' +test_expect_success 'apply to a funny path' ' + with_sq="with'\''sq" + rm -fr .git/rebase-apply && + git reset --hard initial && + git am --directory="$with_sq" "$tm"/am-test-5-2 && + test -f "$with_sq/file-5" +' + test_done -- cgit v1.2.3 From b80da424a13107c239ed40573fae3d692d19b6cd Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Fri, 23 Jan 2009 11:31:21 +1100 Subject: git-am: implement --reject option passed to git-apply With --reject, git-am simply passes the --reject option to git-apply and thus allows people to work with reject files if they so prefer. Signed-off-by: martin f. krafft Signed-off-by: Junio C Hamano --- t/t4252-am-options.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 't/t4252-am-options.sh') diff --git a/t/t4252-am-options.sh b/t/t4252-am-options.sh index 5fdd188582..f603c1b133 100755 --- a/t/t4252-am-options.sh +++ b/t/t4252-am-options.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git am not losing options' +test_description='git am with options and not losing them' . ./test-lib.sh tm="$TEST_DIRECTORY/t4252" @@ -66,4 +66,13 @@ test_expect_success 'apply to a funny path' ' test -f "$with_sq/file-5" ' +test_expect_success 'am --reject' ' + rm -rf .git/rebase-apply && + git reset --hard initial && + test_must_fail git am --reject "$tm"/am-test-6-1 && + grep "@@ -1,3 +1,3 @@" file-2.rej && + test_must_fail git diff-files --exit-code --quiet file-2 && + grep "[-]-reject" .git/rebase-apply/apply-opt +' + test_done -- cgit v1.2.3