aboutsummaryrefslogtreecommitdiff
path: root/apply.c
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2006-01-31 00:36:24 -0500
committerJunio C Hamano <junkio@cox.net>2006-01-31 16:22:01 -0800
commite36f8b6034f9df7e7b0aea912d1c8e850503623e (patch)
treed2b6bb7ac9e7fc39cdc8858e55a1e544be6d2eed /apply.c
parentc8568e139ed2149fbfb7ef9a8d819d5b6b7c554f (diff)
downloadgit-e36f8b6034f9df7e7b0aea912d1c8e850503623e.tar.gz
git-e36f8b6034f9df7e7b0aea912d1c8e850503623e.tar.xz
Make apply accept the -pNUM option like patch does.
This only applies to traditional diffs, not to git diffs. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apply.c b/apply.c
index c471a82e8..79e23a7fb 100644
--- a/apply.c
+++ b/apply.c
@@ -19,6 +19,7 @@
static const char *prefix;
static int prefix_length = -1;
+static int p_value = 1;
static int allow_binary_replacement = 0;
static int check_index = 0;
static int write_index = 0;
@@ -31,7 +32,7 @@ static int no_add = 0;
static int show_index_info = 0;
static int line_termination = '\n';
static const char apply_usage[] =
-"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [-z] <patch>...";
+"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [-z] [-pNUM] <patch>...";
/*
* For "diff-stat" like behaviour, we keep track of the biggest change
@@ -217,7 +218,6 @@ static char * find_name(const char *line, char *def, int p_value, int terminate)
*/
static void parse_traditional_patch(const char *first, const char *second, struct patch *patch)
{
- int p_value = 1;
char *name;
first += 4; // skip "--- "
@@ -1799,6 +1799,10 @@ int main(int argc, char **argv)
excludes = x;
continue;
}
+ if (!strncmp(arg, "-p", 2)) {
+ p_value = atoi(arg + 2);
+ continue;
+ }
if (!strcmp(arg, "--no-add")) {
no_add = 1;
continue;