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 <madduck@madduck.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
martin f. krafft committed
Jan 23, 2009 at 11:31 UTC
b80da424a13107c239ed40573fae3d692d19b6cd
4 files changed
+36
-1
Documentation/git-am.txt
+2
@@ -12,6 +12,7 @@ SYNOPSIS
12
'git am' [--signoff] [--keep] [--utf8 | --no-utf8]
13
[--3way] [--interactive]
14
[--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]
15
+ [--reject]
16
[<mbox> | <Maildir>...]
17
'git am' (--skip | --resolved | --abort)
18
@@ -63,6 +64,7 @@ default. You could use `--no-utf8` to override this.
64
-C<n>::
65
-p<n>::
66
--directory=<dir>::
67
+--reject::
68
These flags are passed to the 'git-apply' (see linkgit:git-apply[1])
69
program that applies
70
the patch.
git-am.sh
+3
@@ -19,6 +19,7 @@ whitespace= pass it through git-apply
19
directory= pass it through git-apply
20
C= pass it through git-apply
21
p= pass it through git-apply
22
+reject pass it through git-apply
23
resolvemsg= override error message when patch failure occurs
24
r,resolved to be used after a patch failure
25
skip skip the current patch
@@ -168,6 +169,8 @@ do
169
git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;;
170
-C|-p)
171
git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
172
+ --reject)
173
+ git_apply_opt="$git_apply_opt $1" ;;
174
--)
175
shift; break ;;
176
*)
t/t4252-am-options.sh
+10
-1
@@ -1,6 +1,6 @@
1
#!/bin/sh
2
3
-test_description='git am not losing options'
3
+test_description='git am with options and not losing them'
4
. ./test-lib.sh
5
6
tm="$TEST_DIRECTORY/t4252"
@@ -66,4 +66,13 @@ test_expect_success 'apply to a funny path' '
66
test -f "$with_sq/file-5"
67
'
68
69
+test_expect_success 'am --reject' '
70
+ rm -rf .git/rebase-apply &&
71
+ git reset --hard initial &&
72
+ test_must_fail git am --reject "$tm"/am-test-6-1 &&
73
+ grep "@@ -1,3 +1,3 @@" file-2.rej &&
74
+ test_must_fail git diff-files --exit-code --quiet file-2 &&
75
+ grep "[-]-reject" .git/rebase-apply/apply-opt
76
+'
77
+
78
test_done
t/t4252/am-test-6-1
new
+21
@@ -0,0 +1,21 @@
1
+From: A U Thor <au.thor@example.com>
2
+Date: Thu Dec 4 16:00:00 2008 -0800
3
+Subject: Huh
4
+
5
+Should fail and leave rejects
6
+
7
+diff --git i/file-2 w/file-2
8
+index 06e567b..b6f3a16 100644
9
+--- i/file-2
10
++++ w/file-2
11
+@@ -1,3 +1,3 @@
12
+-0
13
++One
14
+ 2
15
+ 3
16
+@@ -4,4 +4,4 @@
17
+ 4
18
+ 5
19
+-6
20
++Six
21
+ 7