Browse Source

git-apply: fix rename header parsing

It's not "rename from" and "rename to", it's "rename old" and "rename new".

Which is illogical and doesn't match the "copy from/to" case, but that's
life. Maybe Junio will fix it up one of these days.
maint
Linus Torvalds 20 years ago
parent
commit
33f4d087a9
  1. 6
      apply.c

6
apply.c

@ -435,8 +435,8 @@ static int parse_git_header(char *line, int len, unsigned int size, struct patch
{ "new file mode ", gitdiff_newfile }, { "new file mode ", gitdiff_newfile },
{ "copy from ", gitdiff_copysrc }, { "copy from ", gitdiff_copysrc },
{ "copy to ", gitdiff_copydst }, { "copy to ", gitdiff_copydst },
{ "rename from ", gitdiff_renamesrc }, { "rename old ", gitdiff_renamesrc },
{ "rename to ", gitdiff_renamedst }, { "rename new ", gitdiff_renamedst },
{ "similarity index ", gitdiff_similarity }, { "similarity index ", gitdiff_similarity },
{ "dissimilarity index ", gitdiff_dissimilarity }, { "dissimilarity index ", gitdiff_dissimilarity },
{ "", gitdiff_unrecognized }, { "", gitdiff_unrecognized },
@ -569,7 +569,7 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
if (git_hdr_len < 0) if (git_hdr_len < 0)
continue; continue;
if (!patch->old_name && !patch->new_name) if (!patch->old_name && !patch->new_name)
die("git diff header lacks filename information"); die("git diff header lacks filename information (line %d)", linenr);
*hdrsize = git_hdr_len; *hdrsize = git_hdr_len;
return offset; return offset;
} }

Loading…
Cancel
Save