summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@mellanox.co.il>2007-02-08 15:57:08 +0200
committerJunio C Hamano <junkio@cox.net>2007-02-08 15:23:52 -0800
commit67dad687ad15d26d8e26f4d27874af0bc0965ce2 (patch)
tree4a6d436ff71e9c83a9196a73596f3c6f6aaebd20
parent66e788bc7fd1888cb4834a48006128a6217f88af (diff)
downloadgit-67dad687ad15d26d8e26f4d27874af0bc0965ce2.tar.gz
add -C[NUM] to git-am
Add -C[NUM] to git-am and git-rebase so that patches can be applied even if context has changed a bit. Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--Documentation/git-am.txt4
-rw-r--r--Documentation/git-rebase.txt8
-rwxr-xr-xgit-am.sh12
-rwxr-xr-xgit-rebase.sh7
4 files changed, 25 insertions, 6 deletions
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index aa4ce1ddb0..f7d551e2c7 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/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 977f661b9d..3dff2dfae7 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -7,7 +7,7 @@ git-rebase - Forward-port local commits to the updated upstream head
SYNOPSIS
--------
-'git-rebase' [-v] [--merge] [--onto <newbase>] <upstream> [<branch>]
+'git-rebase' [-v] [--merge] [-CNUM] [--onto <newbase>] <upstream> [<branch>]
'git-rebase' --continue | --skip | --abort
@@ -196,6 +196,12 @@ OPTIONS
-v, \--verbose::
Display a diffstat of what changed upstream since the last rebase.
+-C<n>::
+ Ensure at least <n> lines of surrounding context match before
+ and after each change. When fewer lines of surrounding
+ context exist they all must match. By default no context is
+ ever ignored.
+
include::merge-strategies.txt[]
NOTES
diff --git a/git-am.sh b/git-am.sh
index 1252f26bbd..9a6123437e 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)
diff --git a/git-rebase.sh b/git-rebase.sh
index 9d2f71d15c..b51d19d12e 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -45,6 +45,7 @@ do_merge=
dotest=$GIT_DIR/.dotest-merge
prec=4
verbose=
+git_am_opt=
continue_merge () {
test -n "$prev_head" || die "prev_head must be defined"
@@ -213,6 +214,10 @@ do
-v|--verbose)
verbose=t
;;
+ -C*)
+ git_am_opt=$1
+ shift
+ ;;
-*)
usage
;;
@@ -322,7 +327,7 @@ fi
if test -z "$do_merge"
then
git-format-patch -k --stdout --full-index --ignore-if-in-upstream "$upstream"..ORIG_HEAD |
- git am --binary -3 -k --resolvemsg="$RESOLVEMSG"
+ git am $git_am_opt --binary -3 -k --resolvemsg="$RESOLVEMSG"
exit $?
fi