Print a sane error message if an alias expands to an invalid git command
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Junio C Hamano <junkio@cox.net>
Theodore Ts'o committed
Feb 10, 2007 at 19:33 UTC
f3dd015c9147e3116fc1941d96f4dad38386b1db
1 file changed
+8
-1
git.c
+8
-1
@@ -387,8 +387,15 @@ int main(int argc, const char **argv, char **envp)
387
done_alias = 1;
388
}
389
390
- if (errno == ENOENT)
390
+ if (errno == ENOENT) {
391
+ if (done_alias) {
392
+ fprintf(stderr, "Expansion of alias '%s' failed; "
393
+ "'%s' is not a git-command\n",
394
+ cmd, argv[0]);
395
+ exit(1);
396
+ }
397
help_unknown_cmd(cmd);
398
+ }
399
400
fprintf(stderr, "Failed to run command '%s': %s\n",
401
cmd, strerror(errno));