builtin-apply: Show a more descriptive error on failure when opening a patch
When a patch can't be opened (it doesn't exist, there are permission problems, etc.) we get the usage text, which is not a proper indication of failure. Signed-off-by: Alberto Bertogli <albertito@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alberto Bertogli committed
Apr 14, 2008 at 12:30 UTC
1da16439bece6b90e1ce033bc50c5316f2c5dac2
1 file changed
+1
-1
builtin-apply.c
+1
-1
@@ -2888,7 +2888,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
2888
2889
fd = open(arg, O_RDONLY);
2890
if (fd < 0)
2891
- usage(apply_usage);
2891
+ die("can't open patch '%s': %s", arg, strerror(errno));
2892
read_stdin = 0;
2893
set_default_whitespace_mode(whitespace_option);
2894
errs |= apply_patch(fd, arg, inaccurate_eof);