summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c8568e1)
raw | patch | inline | side by side (parent: c8568e1)
author | Daniel Barkalow <barkalow@iabervon.org> | |
Tue, 31 Jan 2006 05:36:24 +0000 (00:36 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 1 Feb 2006 00:22:01 +0000 (16:22 -0800) |
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>
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-apply.txt | patch | blob | history | |
apply.c | patch | blob | history |
index 51c7d47092010f4275d1de8f074e0cc28e1d5adc..75076b61216c7ee5ce0a55e5a7c578f5f06b6187 100644 (file)
--------
[verse]
'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply]
- [--no-add] [--index-info] [--allow-binary-replacement] [-z]
+ [--no-add] [--index-info] [--allow-binary-replacement] [-z] [-pNUM]
[<patch>...]
DESCRIPTION
backslash characters replaced with `\t`, `\n`, and `\\`,
respectively.
+-p<n>::
+ Remove <n> leading slashes from traditional diff paths. The
+ default is 1.
+
--apply::
If you use any of the options marked ``Turns off
"apply"'' above, git-apply reads and outputs the
index c471a82e83691b152c2b80ea25310afef9b0db95..79e23a7fb930ba7b322a0c30dc87c5b394622e49 100644 (file)
--- a/apply.c
+++ b/apply.c
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;
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 "--- "
excludes = x;
continue;
}
+ if (!strncmp(arg, "-p", 2)) {
+ p_value = atoi(arg + 2);
+ continue;
+ }
if (!strcmp(arg, "--no-add")) {
no_add = 1;
continue;