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

[TopGit PATCH] Require an argument to tg -r

From
MKmartin f. krafft <madduck@debian.org>
Date
Nov 20, 2008, 12:08 UTC
Message-ID
<1227182937-25056-1-git-send-email-madduck@debian.org>

Right now, if -r is passed to tg, an ugly shift error occurs. This patch checks for that case and outputs the help message if it occurs.

Signed-off-by: martin f. krafft <madduck@debian.org>
---
 tg.sh |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/tg.sh b/tg.sh
index 4dcc15e..a5dc0a7 100644
--- a/tg.sh
+++ b/tg.sh
@@ -261,7 +261,13 @@ setup_hook "pre-commit"
 [ -z "$tg__include" ] || return 0
 
 if [ "$1" = "-r" ]; then
-	shift; base_remote="$1"; shift
+	shift
+        if [ -z "$1" ]; then
+		echo "Option -r requires an argument." >&2
+		do_help
+		exit 1
+	fi
+	base_remote="$1"; shift
 	tg="$tg -r $base_remote"
 fi
 
-- 
tg: (f17218e..) fixes/tg--r-require-arg (depends on: upstream)
Message 1 of 1 in “Require an argument to tg -r”
  1. Require an argument to tg -rmartin f. krafft, Nov 20, 2008

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.