threads / patch / 39779

patchgit-filter-branch.sh: clarify an error message

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

## tl;dr

5 messages between Jul 4, 2015 and Jul 11, 2015. Diffs are folded; open one to read it.

replies: 4people: 3as markdown or json

Chris Jones· Jul 4, 2015, 23:39 UTC · lore

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(-)
Show changes to git-filter-branch.sh +1 −2
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
Jeff King· Jul 5, 2015, 13:07 UTC · re: Chris Jones · lore

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

On Sat, Jul 04, 2015 at 07:39:04PM -0400, Chris Jones wrote:
Show 7 quoted lines
> 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".

Yeah, I agree the current message is a little confusing, and I think your message is an improvement. I wonder if we can even go a step further, like mentioning that at least one of the positive tips in your range must be a ref.

-Peff
Johannes Schindelin· Jul 5, 2015, 14:41 UTC · re: Jeff King · lore

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

Hi,
On 2015-07-05 15:07, Jeff King wrote:
Show 14 quoted lines
> On Sat, Jul 04, 2015 at 07:39:04PM -0400, Chris Jones wrote:
> 
>> 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".
> 
> Yeah, I agree the current message is a little confusing, and I think
> your message is an improvement. I wonder if we can even go a step
> further, like mentioning that at least one of the positive tips in your
> range must be a ref.
I agree, and would even further suggest to use the "did not" form instead of the abbreviated "didn't" one.

Thanks, Dscho

Chris Jones· Jul 11, 2015, 02:04 UTC · re: Johannes Schindelin · lore

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

How does "You did not provide a valid range of commits. At least one tip in your range must be a ref." sound?

-- 
Chris
http://christopherjones.us/

On Sun, Jul 5, 2015, at 10:41 AM, Johannes Schindelin wrote:
> Hi,
> 
> On 2015-07-05 15:07, Jeff King wrote:
> > On Sat, Jul 04, 2015 at 07:39:04PM -0400, Chris Jones wrote:
> > 
> >> 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".
> > 
> > Yeah, I agree the current message is a little confusing, and I think
> > your message is an improvement. I wonder if we can even go a step
> > further, like mentioning that at least one of the positive tips in your
> > range must be a ref.
> 
> I agree, and would even further suggest to use the "did not" form instead
> of the abbreviated "didn't" one.
> 
> Thanks,
> Dscho
Johannes Schindelin· Jul 11, 2015, 08:16 UTC · re: Chris Jones · lore

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

Hi Chris,
On 2015-07-11 04:04, Chris Jones wrote:
> How does "You did not provide a valid range of commits.  
> At least one tip in your range must be a ref." sound?
Maybe a bit shorter, as well as less accusing (which "You did not...!" may sound):
    filter-branch requires a valid commit range.

Ciao, Dscho

← back to recent threads