# [PATCH] diffcore-pickaxe: make error messages more consistent

3 messages from 2013-05-14 to 2013-05-14. Participants: Ramkumar Ramachandra, Junio C Hamano.
Thread: https://gitlist.dev/t/33819

## Ramkumar Ramachandra, 2013-05-14 14:16

Subject: [PATCH] diffcore-pickaxe: make error messages more consistent
Message-ID: <1368540973-25830-1-git-send-email-artagnon@gmail.com>
URL: https://gitlist.dev/e/1368540973-25830-1-git-send-email-artagnon%40gmail.com

```
Currently, diffcore-pickaxe reports two distinct errors for the same
user error:

    $ git log --pickaxe-regex -S'\1'
    fatal: invalid pickaxe regex: Invalid back reference

    $ git log -G'\1' # --pickaxe-regex is implied
    fatal: invalid log-grep regex: Invalid back reference

Since the error has nothing to do with "log-grep", change the -G error
message to match the -S error message.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Sorry I couldn't do more.  diffcore-pickaxe.c isn't at all easy to
 hack on, because there are so few tests guarding it.

 diffcore-pickaxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
index 63722f8..d69a7a2 100644
--- a/diffcore-pickaxe.c
+++ b/diffcore-pickaxe.c
@@ -122,7 +122,7 @@ static void diffcore_pickaxe_grep(struct diff_options *o)
 		char errbuf[1024];
 		regerror(err, &regex, errbuf, 1024);
 		regfree(&regex);
-		die("invalid log-grep regex: %s", errbuf);
+		die("invalid pickaxe regex: %s", errbuf);
 	}
 
 	pickaxe(&diff_queued_diff, o, &regex, NULL, diff_grep);
-- 
1.8.3.rc1.61.g2cacfff

```

## Junio C Hamano, 2013-05-14 17:46

Subject: Re: [PATCH] diffcore-pickaxe: make error messages more consistent
Message-ID: <7vsj1pjvyz.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vsj1pjvyz.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1368540973-25830-1-git-send-email-artagnon@gmail.com>

```
Ramkumar Ramachandra <artagnon@gmail.com> writes:

> Currently, diffcore-pickaxe reports two distinct errors for the same
> user error:
>
>     $ git log --pickaxe-regex -S'\1'
>     fatal: invalid pickaxe regex: Invalid back reference
>
>     $ git log -G'\1' # --pickaxe-regex is implied
>     fatal: invalid log-grep regex: Invalid back reference
>
> Since the error has nothing to do with "log-grep", change the -G error
> message to match the -S error message.
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>  Sorry I couldn't do more.  diffcore-pickaxe.c isn't at all easy to
>  hack on, because there are so few tests guarding it.
>
>  diffcore-pickaxe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c
> index 63722f8..d69a7a2 100644
> --- a/diffcore-pickaxe.c
> +++ b/diffcore-pickaxe.c
> @@ -122,7 +122,7 @@ static void diffcore_pickaxe_grep(struct diff_options *o)
>  		char errbuf[1024];
>  		regerror(err, &regex, errbuf, 1024);
>  		regfree(&regex);
> -		die("invalid log-grep regex: %s", errbuf);
> +		die("invalid pickaxe regex: %s", errbuf);
>  	}
>  
>  	pickaxe(&diff_queued_diff, o, &regex, NULL, diff_grep);

I am debating myself if it is truly easier to explain for users that
"-G" is a different variant of pickaxe.

It happens to be implemented in the same source file as pickaxe, but
they do logically quite different things.  -G does not even have a
reason to pay attention to --pickaxe-regexp (it is "grep in the log
-p").

I suspect that it might avoid unnecessary confusion to explain them
as totally separate operations, and not labelling this error with
"pickaxe regex".  I dunno.

```

## Ramkumar Ramachandra, 2013-05-14 18:15

Subject: Re: [PATCH] diffcore-pickaxe: make error messages more consistent
Message-ID: <CALkWK0nDU4o4HT6FXc_z=5DfZzQgexFYLWMLh4+3tevW+VXwBg@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0nDU4o4HT6FXc_z%3D5DfZzQgexFYLWMLh4%2B3tevW%2BVXwBg%40mail.gmail.com
In-Reply-To: <7vsj1pjvyz.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano wrote:
> I am debating myself if it is truly easier to explain for users that
> "-G" is a different variant of pickaxe.

Hm, I think it is the correct approach because readers of diffcore are
probably going to look at the source: it's not exactly an end-user
manpage.  I've not explained it as G king versus S kind in the
diff-options documentation.

Or are you just talking about the error message?  That's simple:
--pickaxe-regex is what triggers this off, and we've made it clear
that it applies to both commands (-G implicitly; see doc).

```
