Print a sane error message if an alias expands to an invalid git command
authorTheodore Ts'o <tytso@mit.edu>
Sun, 11 Feb 2007 00:33:57 +0000 (19:33 -0500)
committerJunio C Hamano <junkio@cox.net>
Sun, 11 Feb 2007 06:46:30 +0000 (22:46 -0800)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git.c

diff --git a/git.c b/git.c
index 82a8357272bee1ad6d452a19bf9270f94d94a6cc..c43d4ff1fdf6c056af1b5569079ad9090df564c8 100644 (file)
--- a/git.c
+++ b/git.c
@@ -387,8 +387,15 @@ int main(int argc, const char **argv, char **envp)
                done_alias = 1;
        }
 
-       if (errno == ENOENT)
+       if (errno == ENOENT) {
+               if (done_alias) {
+                       fprintf(stderr, "Expansion of alias '%s' failed; "
+                               "'%s' is not a git-command\n",
+                               cmd, argv[0]);
+                       exit(1);
+               }
                help_unknown_cmd(cmd);
+       }
 
        fprintf(stderr, "Failed to run command '%s': %s\n",
                cmd, strerror(errno));