Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit 6f9f3b2

Browse files
author
Junio C Hamano
committed
apply: handle "traditional" creation/deletion diff correctly.
We deduced a GNU diff output that does not use /dev/null convention as creation (deletion) diff correctly by looking at the lack of context and deleted lines (added lines), but forgot to reset the new (old) name field properly. This was a regression when we added a workaround for --unified=0 insanity. Signed-off-by: Junio C Hamano <[email protected]>
1 parent ba158a3 commit 6f9f3b2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

builtin-apply.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,14 @@ static int parse_single_patch(char *line, unsigned long size, struct patch *patc
10431043
* then not having oldlines means the patch is creation,
10441044
* and not having newlines means the patch is deletion.
10451045
*/
1046-
if (patch->is_new < 0 && !oldlines)
1046+
if (patch->is_new < 0 && !oldlines) {
10471047
patch->is_new = 1;
1048-
if (patch->is_delete < 0 && !newlines)
1048+
patch->old_name = NULL;
1049+
}
1050+
if (patch->is_delete < 0 && !newlines) {
10491051
patch->is_delete = 1;
1052+
patch->new_name = NULL;
1053+
}
10501054
}
10511055

10521056
if (0 < patch->is_new && oldlines)

0 commit comments

Comments
 (0)