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

5 messages from 2015-07-04 to 2015-07-11. Participants: Chris Jones, Jeff King, Johannes Schindelin.
Thread: https://gitlist.dev/t/39779

## Chris Jones, 2015-07-04 23:39

Subject: [PATCH] git-filter-branch.sh: clarify an error message
Message-ID: <1436053144.3463091.315316457.1BAF8BA7@webmail.messagingengine.com>
URL: https://gitlist.dev/e/1436053144.3463091.315316457.1BAF8BA7%40webmail.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

```

## Jeff King, 2015-07-05 13:07

Subject: Re: [PATCH] git-filter-branch.sh: clarify an error message
Message-ID: <20150705130706.GA5435@peff.net>
URL: https://gitlist.dev/e/20150705130706.GA5435%40peff.net
In-Reply-To: <1436053144.3463091.315316457.1BAF8BA7@webmail.messagingengine.com>

```
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.

-Peff

```

## Johannes Schindelin, 2015-07-05 14:41

Subject: Re: [PATCH] git-filter-branch.sh: clarify an error message
Message-ID: <aca69b93d8ab5f3c610d6201ed4334e1@www.dscho.org>
URL: https://gitlist.dev/e/aca69b93d8ab5f3c610d6201ed4334e1%40www.dscho.org
In-Reply-To: <20150705130706.GA5435@peff.net>

```
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

```

## Chris Jones, 2015-07-11 02:04

Subject: Re: [PATCH] git-filter-branch.sh: clarify an error message
Message-ID: <1436580240.2553376.320852705.0F1D7187@webmail.messagingengine.com>
URL: https://gitlist.dev/e/1436580240.2553376.320852705.0F1D7187%40webmail.messagingengine.com
In-Reply-To: <aca69b93d8ab5f3c610d6201ed4334e1@www.dscho.org>

```
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, 2015-07-11 08:16

Subject: Re: [PATCH] git-filter-branch.sh: clarify an error message
Message-ID: <e753df13e78f23744fce015ca58be47a@www.dscho.org>
URL: https://gitlist.dev/e/e753df13e78f23744fce015ca58be47a%40www.dscho.org
In-Reply-To: <1436580240.2553376.320852705.0F1D7187@webmail.messagingengine.com>

```
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

```
