aboutsummaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-04-04 11:19:14 -0400
committerJunio C Hamano <junkio@cox.net>2007-04-05 15:06:58 -0700
commit79ee194e52a140412da475e102145bad80d5d00a (patch)
treed963fe533852d2015b21d43a68e2dd4864dcaccb /builtin-apply.c
parent766b084f59c97bc8b096a59cd5c8d06df5aa2bc5 (diff)
downloadgit-79ee194e52a140412da475e102145bad80d5d00a.tar.gz
git-79ee194e52a140412da475e102145bad80d5d00a.tar.xz
Honor -p<n> when applying git diffs
If the user is trying to apply a Git generated diff file and they have specified a -p<n> option, where <n> is not 1, the user probably has a good reason for doing this. Such as they are me, trying to apply a patch generated in git.git for the git-gui subdirectory to the git-gui.git repository, where there is no git-gui subdirectory present. Users shouldn't supply -p2 unless they mean it. But if they are supplying it, they probably have thought about how to make this patch apply to their working directory, and want to risk whatever results may come from that. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 27a182bfa..a5d612655 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -417,7 +417,7 @@ static int gitdiff_hdrend(const char *line, struct patch *patch)
static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, const char *oldnew)
{
if (!orig_name && !isnull)
- return find_name(line, NULL, 1, TERM_TAB);
+ return find_name(line, NULL, p_value, TERM_TAB);
if (orig_name) {
int len;
@@ -427,7 +427,7 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
len = strlen(name);
if (isnull)
die("git-apply: bad git-diff - expected /dev/null, got %s on line %d", name, linenr);
- another = find_name(line, NULL, 1, TERM_TAB);
+ another = find_name(line, NULL, p_value, TERM_TAB);
if (!another || memcmp(another, name, len))
die("git-apply: bad git-diff - inconsistent %s filename on line %d", oldnew, linenr);
free(another);