Thread (37 messages) flat view 37 messages, 8 authors, 2016-06-15
DORMANTno replies

[PATCH] Print a sane error message if an alias expands to an invalid git command

From: Theodore Ts'o <tytso@mit.edu>
Date: 2016-06-15 22:42:53
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 git.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/git.c b/git.c
index 82a8357..c43d4ff 100644
--- 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));
-- 
1.5.0.rc4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help