[PATCH] add -C[NUM] to git-am

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Michael S. Tsirkin
Date: Wednesday, February 7, 2007 - 1:15 pm

Add -C[NUM] to git-am so that patches can be applied even
if context has changed a bit.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>

---

I just had to apply a largish number of patches on a project
that has evolved since, and I found the following to be useful.

What do others think.

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index aa4ce1d..f7d551e 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -64,6 +64,10 @@ default.   You could use `--no-utf8` to override this.
 	This flag is passed to the `git-apply` program that applies
 	the patch.
 
+-C<n>::
+	This flag is passed to the `git-apply` program that applies
+	the patch.
+
 --interactive::
 	Run interactively, just like git-applymbox.
 
diff --git a/git-am.sh b/git-am.sh
index 1252f26..9a61234 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -3,7 +3,7 @@
 # Copyright (c) 2005, 2006 Junio C Hamano
 
 USAGE='[--signoff] [--dotest=<dir>] [--utf8 | --no-utf8] [--binary] [--3way]
-  [--interactive] [--whitespace=<option>] <mbox>...
+  [--interactive] [--whitespace=<option>] [-CNUM] <mbox>...
   or, when resuming [--skip | --resolved]'
 . git-sh-setup
 set_reflog_action am
@@ -106,7 +106,8 @@ It does not apply to blobs recorded in its index."
 }
 
 prec=4
-dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= ws= resolvemsg=
+dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary= resolvemsg=
+git_apply_opt=
 
 while case "$#" in 0) break;; esac
 do
@@ -142,7 +143,10 @@ do
 	skip=t; shift ;;
 
 	--whitespace=*)
-	ws=$1; shift ;;
+	git_apply_opt="$git_apply_opt $1"; shift ;;
+
+	-C*)
+	git_apply_opt="$git_apply_opt $1"; shift ;;
 
 	--resolvemsg=*)
 	resolvemsg=$(echo "$1" | sed -e "s/^--resolvemsg=//"); shift ;;
@@ -394,7 +398,7 @@ do
 
 	case "$resolved" in
 	'')
-		git-apply $binary --index $ws "$dotest/patch"
+		git-apply $git_apply_opt $binary --index "$dotest/patch"
 		apply_status=$?
 		;;
 	t)

-- 
MST
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] add -C[NUM] to git-am, Michael S. Tsirkin, (Wed Feb 7, 1:15 pm)
Re: [PATCH] add -C[NUM] to git-am, Junio C Hamano, (Wed Feb 7, 1:23 pm)
Re: [PATCH] add -C[NUM] to git-am, Michael S. Tsirkin, (Wed Feb 7, 2:19 pm)
Re: [PATCH] add -C[NUM] to git-am, Johannes Schindelin, (Wed Feb 7, 4:50 pm)
Re: [PATCH] add -C[NUM] to git-am, Junio C Hamano, (Thu Feb 8, 12:52 am)
Re: [PATCH] add -C[NUM] to git-am, Michael S. Tsirkin, (Thu Feb 8, 6:57 am)
Re: [PATCH] add -C[NUM] to git-am, Junio C Hamano, (Thu Feb 8, 4:04 pm)