summaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-21 04:28:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-21 04:28:50 (GMT)
commitdf91d0e4d30ddc9bf2c55e3a63be9cb5318a409a (patch)
tree0de68b9b3ef9f2b0a72363af19fce18156d31537 /builtin-apply.c
parentfcb2a7e4a3c7899a3432f5804889fa3ea5779220 (diff)
parent158620872737067e4a74ca7aed5302af8debb714 (diff)
downloadgit-df91d0e4d30ddc9bf2c55e3a63be9cb5318a409a.zip
git-df91d0e4d30ddc9bf2c55e3a63be9cb5318a409a.tar.gz
git-df91d0e4d30ddc9bf2c55e3a63be9cb5318a409a.tar.bz2
Merge branch 'ag/maint-apply-too-large-p'
* ag/maint-apply-too-large-p: builtin-apply.c: Skip filenames without enough components
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 541493e..b99db0b 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -404,6 +404,9 @@ static char *squash_slash(char *name)
{
int i = 0, j = 0;
+ if (!name)
+ return NULL;
+
while (name[i]) {
if ((name[j++] = name[i++]) == '/')
while (name[i] == '/')
@@ -416,7 +419,10 @@ static char *squash_slash(char *name)
static char *find_name(const char *line, char *def, int p_value, int terminate)
{
int len;
- const char *start = line;
+ const char *start = NULL;
+
+ if (p_value == 0)
+ start = line;
if (*line == '"') {
struct strbuf name = STRBUF_INIT;
@@ -1199,7 +1205,8 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
continue;
if (!patch->old_name && !patch->new_name) {
if (!patch->def_name)
- die("git diff header lacks filename information (line %d)", linenr);
+ die("git diff header lacks filename information when removing "
+ "%d leading pathname components (line %d)" , p_value, linenr);
patch->old_name = patch->new_name = patch->def_name;
}
patch->is_toplevel_relative = 1;