From: Federico Cuello <fedux@lugmen.org.ar>
To: git@vger.kernel.org
Cc: Federico Cuello <fedux@lugmen.org.ar>
Subject: [PATCH] Fix git-apply with -p greater than 1
Date: Thu, 21 Oct 2010 19:12:02 -0300 [thread overview]
Message-ID: <1287699122-26702-1-git-send-email-fedux@lugmen.org.ar> (raw)
Fix the case when the patch is a rename or mode-change only
and -p is used with a value greater than one.
The git_header_name function did not remove more than one path
component.
Signed-off-by: Federico Cuello <fedux@lugmen.org.ar>
---
builtin/apply.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 23c18c5..14996f8 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1132,15 +1132,11 @@ static char *git_header_name(char *line, int llen)
case '\n':
return NULL;
case '\t': case ' ':
- second = name+len;
- for (;;) {
- char c = *second++;
- if (c == '\n')
- return NULL;
- if (c == '/')
- break;
- }
- if (second[len] == '\n' && !memcmp(name, second, len)) {
+ second = stop_at_slash(name + len, (name - line) + len);
+ if (!second)
+ return NULL;
+ second++;
+ if (second[len] == '\n' && !strncmp(name, second, len)) {
return xmemdupz(name, len);
}
}
--
1.7.3.1
next reply other threads:[~2010-10-21 22:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 22:12 Federico Cuello [this message]
2010-10-22 5:01 ` [PATCH] Fix git-apply with -p greater than 1 Junio C Hamano
2010-10-22 5:31 ` Jonathan Nieder
2010-10-22 13:42 ` Fede
2010-10-22 15:38 ` Jonathan Nieder
2010-10-22 18:41 ` Junio C Hamano
2010-10-22 18:51 ` Federico Cuello
2010-10-25 14:11 ` Federico Cuello
2010-10-22 18:40 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1287699122-26702-1-git-send-email-fedux@lugmen.org.ar \
--to=fedux@lugmen.org.ar \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).