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

[PATCH] git-filter-branch.sh: clarify an error message

From
CJChris Jones <chris@christopherjones.us>
Date
Jul 4, 2015, 23:39 UTC
Message-ID
<1436053144.3463091.315316457.1BAF8BA7@webmail.messagingengine.com>

Make git filter-branch output a useful error message when a single commit is given instead of a range. Currently, when given a command like git filter-branch --msg-filter 'echo "TEST"' -- abc123, it will give the message "Which ref do you want to rewrite?". Instead, what is needed is a range of commits to rewrite. This makes it give an error message that says "You didn't provide a valid range of commits".

Signed-off-by: Chris W Jones <chris@christopherjones.us>
---
 git-filter-branch.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 5b3f63d..78e7499 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -237,7 +237,7 @@ git rev-parse --no-flags --revs-only
--symbolic-full-name \
 sed -e '/^^/d' "$tempdir"/raw-heads >"$tempdir"/heads
 
 test -s "$tempdir"/heads ||
-       die "Which ref do you want to rewrite?"
+       die "You didn't provide a valid range of commits."
 
 GIT_INDEX_FILE="$(pwd)/../index"
 export GIT_INDEX_FILE
-- 
1.9.3
Next: Jeff King
Message 1 of 5 in “git-filter-branch.sh: clarify an error message”
  1. git-filter-branch.sh: clarify an error messageChris Jones, Jul 4, 2015
  2. Jeff KingJul 5, 2015
  3. Johannes SchindelinJul 5, 2015
  4. Chris JonesJul 11, 2015
  5. Johannes SchindelinJul 11, 2015

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.