author | Brandon Casey <drafnel@gmail.com> | |
Sat, 3 Dec 2011 20:35:50 +0000 (14:35 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 5 Dec 2011 19:20:50 +0000 (11:20 -0800) | ||
commit | cc64b318f26c9e176c4f07b1a459a86e7a04c4eb | |
tree | 7199e2205d9d1ec141595731eec3a9c2388b3df1 | tree | snapshot |
parent | 590a472b363ba9d6e75b1dbf07f20e80ae9a587d | commit | diff |
builtin/apply.c: report error on failure to recognize input
When git apply is passed something that is not a patch, it does not produce
an error message or exit with a non-zero status if it was not actually
"applying" the patch i.e. --check or --numstat etc were supplied on the
command line.
Fix this by producing an error when apply fails to find any hunks whatsoever
while parsing the patch.
This will cause some of the output formats (--numstat, --diffstat, etc) to
produce an error when they formerly would have reported zero changes and
exited successfully. That seems like the correct behavior though. Failure
to recognize the input as a patch should be an error.
Plus, add a test.
Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When git apply is passed something that is not a patch, it does not produce
an error message or exit with a non-zero status if it was not actually
"applying" the patch i.e. --check or --numstat etc were supplied on the
command line.
Fix this by producing an error when apply fails to find any hunks whatsoever
while parsing the patch.
This will cause some of the output formats (--numstat, --diffstat, etc) to
produce an error when they formerly would have reported zero changes and
exited successfully. That seems like the correct behavior though. Failure
to recognize the input as a patch should be an error.
Plus, add a test.
Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/apply.c | diff | blob | history | |
t/t4136-apply-check.sh | [new file with mode: 0755] | blob |