From: Alberto Bertogli <albertito@gmail.com>
To: git@vger.kernel.org, Johannes.Schindelin@gmx.de, gitster@pobox.com
Cc: Alberto Bertogli <albertito@gmail.com>
Subject: [PATCH] builtin-apply: Show a more descriptive error on failure when opening a patch
Date: Mon, 14 Apr 2008 11:23:38 -0300 [thread overview]
Message-ID: <1208183018-27887-1-git-send-email-albertito@gmail.com> (raw)
In-Reply-To: <7vtzi5bkdz.fsf@gitster.siamese.dyndns.org>
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.
This patch fixes that by calling error() instead.
Signed-off-by: Alberto Bertogli <albertito@gmail.com>
---
This one (hopefuly) addresses both Junio and Johannes' comments.
Thanks,
Alberto
builtin-apply.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index abe73a0..ebbe609 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -3120,8 +3120,12 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
arg = prefix_filename(prefix, prefix_length, arg);
fd = open(arg, O_RDONLY);
- if (fd < 0)
- usage(apply_usage);
+ if (fd < 0) {
+ error("can't open patch '%s': %s", arg,
+ strerror(errno));
+ return 1;
+ }
+
read_stdin = 0;
set_default_whitespace_mode(whitespace_option);
errs |= apply_patch(fd, arg, inaccurate_eof);
--
1.5.5.105.g9d11e.dirty
next prev parent reply other threads:[~2008-04-14 14:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-13 18:56 [PATCH] builtin-apply: Show a more descriptive error on failure when opening a patch Alberto Bertogli
2008-04-13 19:54 ` Junio C Hamano
2008-04-14 14:23 ` Alberto Bertogli [this message]
2008-04-14 14:33 ` Johannes Schindelin
2008-04-14 15:30 ` Alberto Bertogli
2008-04-16 5:20 ` Junio C Hamano
2008-04-14 14:03 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1208183018-27887-1-git-send-email-albertito@gmail.com \
--to=albertito@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).