mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
git-apply: use default name for mode change patches
Pure mode changes won't have the file-name in the extended header lines, so make sure we pick it up from the default name from the "diff --git" line.
This commit is contained in:
parent
aeac668125
commit
b7e8039a6f
7
apply.c
7
apply.c
|
@ -570,8 +570,11 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
|
||||||
int git_hdr_len = parse_git_header(line, len, size, patch);
|
int git_hdr_len = parse_git_header(line, len, size, patch);
|
||||||
if (git_hdr_len <= len)
|
if (git_hdr_len <= len)
|
||||||
continue;
|
continue;
|
||||||
if (!patch->old_name && !patch->new_name)
|
if (!patch->old_name && !patch->new_name) {
|
||||||
die("git diff header lacks filename information (line %d)", linenr);
|
if (!patch->def_name)
|
||||||
|
die("git diff header lacks filename information (line %d)", linenr);
|
||||||
|
patch->old_name = patch->new_name = patch->def_name;
|
||||||
|
}
|
||||||
*hdrsize = git_hdr_len;
|
*hdrsize = git_hdr_len;
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue