git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Theodore Ts'o <tytso@mit.edu>
Date
Feb 11, 2007, 00:33 UTC
Message-ID
<1171154038778-git-send-email-tytso@mit.edu>
In-Reply-To
<11711540383470-git-send-email-tytso@mit.edu>
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.2.g4249
Previous: Theodore Ts'oNext: Theodore Ts'o
Message 2 of 4 in “Respun patches for git aliases enhancement”
  1. 0/2 Respun patches for git aliases enhancementTheodore Ts'o, Feb 11, 2007
  2. 1/2 Print a sane error message if an alias expands to an invalid git commandTheodore Ts'o, Feb 11, 2007
  3. 2/2 Allow aliases to expand to shell commandsTheodore Ts'o, Feb 11, 2007
  4. Johannes SchindelinFeb 11, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.