From: Michele Ballabio <barra_cuda@katamail.com>
To: Peter Krefting <peter@softwolves.pp.se>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] help.c: don't blame an user's typo when the system is at fault
Date: Mon, 20 Jul 2009 15:45:05 +0200 [thread overview]
Message-ID: <200907201545.06030.barra_cuda@katamail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.0907201309150.5423@ds9.cixit.se>
As reported by Peter Krefting:
If git cannot start one of the external commands (at least some of them),
the DWIM engine is a bit flaky:
$ git citool
/usr/local/libexec/git-core/git-citool: line 10: exec: wish: not found
git: 'citool' is not a git-command. See 'git --help'.
Did you mean this?
citool
Now we check whether the best bet found by levenshtein() differs from
the command line or not before proceeding.
The new error is:
$ git citool
/usr/local/libexec/git-core/git-citool: line 10: exec: wish: not found
fatal: Failed to run command 'citool': No such file or directory
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---
Is the call to strerror() useless anyway?
help.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/help.c b/help.c
index fd87bb5..eec62a3 100644
--- a/help.c
+++ b/help.c
@@ -325,6 +325,9 @@ const char *help_unknown_cmd(const char *cmd)
if (!main_cmds.cnt)
die ("Uh oh. Your system reports no Git commands at all.");
+ if (!strcmp(cmd, main_cmds.names[0]->name))
+ die("Failed to run command '%s': %s\n",
+ cmd, strerror(errno));
best_similarity = main_cmds.names[0]->len;
n = 1;
--
1.6.3.1.17.g076c3
next prev parent reply other threads:[~2009-07-20 13:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-20 12:11 Bad DWIM response when git gui cannot start Peter Krefting
2009-07-20 13:45 ` Michele Ballabio [this message]
2009-07-20 14:17 ` [PATCH] help.c: don't blame an user's typo when the system is at fault Thomas Rast
2009-07-20 15:12 ` Jeff King
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=200907201545.06030.barra_cuda@katamail.com \
--to=barra_cuda@katamail.com \
--cc=git@vger.kernel.org \
--cc=peter@softwolves.pp.se \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.