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

[PATCH] Trivial fix: Display a more friendly message with git-shell.

From
Thiago Farina <tfransosi@gmail.com>
Date
Sep 20, 2009, 17:11 UTC
Message-ID
<1253466672-21051-1-git-send-email-tfransosi@gmail.com>

Instead of simply die without give a helpful message, displays the usage string that shows to the user how it can be used.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
 shell.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/shell.c b/shell.c
index e4864e0..aa7f47e 100644
--- a/shell.c
+++ b/shell.c
@@ -3,6 +3,8 @@
 #include "exec_cmd.h"
 #include "strbuf.h"
 
+static const char shell_usage[] = "git shell -c <command> <argument>";
+
 static int do_generic_cmd(const char *me, char *arg)
 {
 	const char *my_argv[4];
@@ -74,7 +76,7 @@ int main(int argc, char **argv)
 	 * where "cmd" is a very limited subset of git commands.
 	 */
 	else if (argc != 3 || strcmp(argv[1], "-c"))
-		die("What do you think I am? A shell?");
+		usage(shell_usage);
 
 	prog = argv[2];
 	if (!strncmp(prog, "git", 3) && isspace(prog[3]))
-- 
1.6.5.rc1.37.gf5c31.dirty
Next: Tay Ray Chuan
Message 1 of 8 in “Trivial fix: Display a more friendly message with git-shell.”
  1. Trivial fix: Display a more friendly message with git-shell.Thiago Farina, Sep 20, 2009
  2. Tay Ray ChuanSep 21, 2009
  3. Johannes SixtSep 21, 2009
  4. Matthieu MoySep 21, 2009
  5. Thiago FarinaSep 21, 2009
  6. Matthieu MoySep 22, 2009
  7. Heiko VoigtSep 22, 2009
  8. Jakub NarebskiSep 22, 2009

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.