threads / discuss / 38348

commit --amend --author error

Subject: commit --amend --author error

## tl;dr

21 messages between Jan 13, 2015 and Jan 27, 2015.

replies: 20people: 7as markdown or json

Gunnar Wagner· Jan 13, 2015, 08:15 UTC · lore

I got APGL licensed code from someone else and want to post it on my github (without taking credit for the work)

tried git commit --amend --author="Author name, www.website.com" but got an error message which said something like "original author not found" Can it be that the --amen --author only work if the author is on github himself?

Michael J Gruber· Jan 13, 2015, 11:24 UTC · re: Gunnar Wagner · lore

Re: commit --amend --author error

Gunnar Wagner schrieb am 13.01.2015 um 09:15:
Show 8 quoted lines
> I got APGL licensed code from someone else and want to post it on my 
> github (without taking credit for the work)
> 
> tried   git commit --amend --author="Author name, www.website.com" but 
> got an error message which said something like "original author not found"
> Can it be that the --amen --author only work if the author is on github 
> himself?
> 
This has nothing to do with github.

The author has be in the form "authorname <authoremail>". The important parts for the format are the <>.

Michael
Jeff King· Jan 14, 2015, 12:09 UTC · re: Michael J Gruber · lore

Re: commit --amend --author error

On Tue, Jan 13, 2015 at 12:24:18PM +0100, Michael J Gruber wrote:
Show 14 quoted lines
> Gunnar Wagner schrieb am 13.01.2015 um 09:15:
> > I got APGL licensed code from someone else and want to post it on my 
> > github (without taking credit for the work)
> > 
> > tried   git commit --amend --author="Author name, www.website.com" but 
> > got an error message which said something like "original author not found"
> > Can it be that the --amen --author only work if the author is on github 
> > himself?
> > 
> 
> This has nothing to do with github.
> 
> The author has be in the form "authorname <authoremail>". The important
> parts for the format are the <>.

Yes, but the error message is a hint that there is something else going on. When there are no angle brackets, some DWIM magic kicks in: git tries to find a matching author by walking the project history from HEAD. So you can do (in git.git):

  $ git commit --allow-empty -m foo --author=gruber
  [detached HEAD 73ef08b] foo
   Author: Michael J Gruber <git@drmicha.warpmail.net>

Of course that does not work if you do not already have commits from the person in your repository:

  $ git commit --allow-empty -m foo --author=foobar
  fatal: No existing author found with 'foobar'
-Peff
Michael J Gruber· Jan 15, 2015, 14:21 UTC · re: Jeff King · lore

Re: commit --amend --author error

Jeff King schrieb am 14.01.2015 um 13:09:
Show 25 quoted lines
> On Tue, Jan 13, 2015 at 12:24:18PM +0100, Michael J Gruber wrote:
> 
>> Gunnar Wagner schrieb am 13.01.2015 um 09:15:
>>> I got APGL licensed code from someone else and want to post it on my 
>>> github (without taking credit for the work)
>>>
>>> tried   git commit --amend --author="Author name, www.website.com" but 
>>> got an error message which said something like "original author not found"
>>> Can it be that the --amen --author only work if the author is on github 
>>> himself?
>>>
>>
>> This has nothing to do with github.
>>
>> The author has be in the form "authorname <authoremail>". The important
>> parts for the format are the <>.
> 
> Yes, but the error message is a hint that there is something else going
> on. When there are no angle brackets, some DWIM magic kicks in: git
> tries to find a matching author by walking the project history from
> HEAD. So you can do (in git.git):
> 
>   $ git commit --allow-empty -m foo --author=gruber
>   [detached HEAD 73ef08b] foo
>    Author: Michael J Gruber <git@drmicha.warpmail.net>
(git commit --allow-almost-empty in the case of that author, hum)
Show 7 quoted lines
> Of course that does not work if you do not already have commits from the
> person in your repository:
> 
>   $ git commit --allow-empty -m foo --author=foobar
>   fatal: No existing author found with 'foobar'
> 
> -Peff
That is the full explanation, yes:

Neither can "Author name, www.website.com" be parsed as a complete valid "name <email>" nor can it be matched as part of an existing "name <email>" in the repo.

The OP clearly tried to do the first and got an error message about the second. Maybe we can do better here?

Michael
Michael J Gruber· Jan 15, 2015, 14:23 UTC · re: Michael J Gruber · lore

[PATCH] commit: reword --author error message

If an --author argument is specified but does not contain a '>' then git tries to find the argument within the exiting authors; and gives the error message "No existing author found with '%s'" if there is no match.

This is confusing for users who try to specify a valid complete author name.

Rename the error message to make it clearer that the failure has two reasons in this case: "Bad --author parameter '%s': neither completely wellformed nor part of an existing one"

(This codepath is touched only when we know already that the argument cannot be a completely wellformed author ident.)

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 builtin/commit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 7d90c35..851e2c5 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1056,7 +1056,7 @@ static const char *find_author_by_nickname(const char *name)
 		clear_mailmap(&mailmap);
 		return strbuf_detach(&buf, NULL);
 	}
-	die(_("No existing author found with '%s'"), name);
+	die(_("Bad --author parameter '%s': neither completely wellformed nor part of an existing one"), name);
 }
 
 
-- 
2.3.0.rc0.202.g6f441c7
Michael J Gruber· Jan 15, 2015, 14:25 UTC · re: Michael J Gruber · lore

Re: [PATCH] commit: reword --author error message

Michael J Gruber schrieb am 15.01.2015 um 15:23:
> If an --author argument is specified but does not contain a '>' then git tries
> to find the argument within the exiting authors; and gives the error
> message "No existing author found with '%s'" if there is no match.

Oh well, I'm bracing already for the comments on that entertaining typo... Can I buy an 's', please?

Show 30 quoted lines
> This is confusing for users who try to specify a valid complete author
> name.
> 
> Rename the error message to make it clearer that the failure has two
> reasons in this case:
> "Bad --author parameter '%s': neither completely wellformed nor part of
> an existing one"
> 
> (This codepath is touched only when we know already that the argument
> cannot be a completely wellformed author ident.)
> 
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
>  builtin/commit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 7d90c35..851e2c5 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1056,7 +1056,7 @@ static const char *find_author_by_nickname(const char *name)
>  		clear_mailmap(&mailmap);
>  		return strbuf_detach(&buf, NULL);
>  	}
> -	die(_("No existing author found with '%s'"), name);
> +	die(_("Bad --author parameter '%s': neither completely wellformed nor part of an existing one"), name);
>  }
>  
>  
> 
Jeff King· Jan 15, 2015, 14:31 UTC · re: Michael J Gruber · lore

Re: [PATCH] commit: reword --author error message

On Thu, Jan 15, 2015 at 03:23:08PM +0100, Michael J Gruber wrote:
Show 11 quoted lines
> If an --author argument is specified but does not contain a '>' then git tries
> to find the argument within the exiting authors; and gives the error
> message "No existing author found with '%s'" if there is no match.
> 
> This is confusing for users who try to specify a valid complete author
> name.
> 
> Rename the error message to make it clearer that the failure has two
> reasons in this case:
> "Bad --author parameter '%s': neither completely wellformed nor part of
> an existing one"

I really like the intent of this patch, but I actually find the new message even more confusing.

Is this a time when we could use hint() to give a multi-line explanation (and probably a matching advice.* config)? Like:

  hint: If the --author parameter contains angle brackets ("<>"), it
  hint: is treated as a literal name/email pair to use. If not, then
  hint: the history is searched for an existing matching author.
or something?
-Peff
Michael J Gruber· Jan 15, 2015, 14:40 UTC · re: Jeff King · lore

Re: [PATCH] commit: reword --author error message

Jeff King schrieb am 15.01.2015 um 15:31:
Show 16 quoted lines
> On Thu, Jan 15, 2015 at 03:23:08PM +0100, Michael J Gruber wrote:
> 
>> If an --author argument is specified but does not contain a '>' then git tries
>> to find the argument within the exiting authors; and gives the error
>> message "No existing author found with '%s'" if there is no match.
>>
>> This is confusing for users who try to specify a valid complete author
>> name.
>>
>> Rename the error message to make it clearer that the failure has two
>> reasons in this case:
>> "Bad --author parameter '%s': neither completely wellformed nor part of
>> an existing one"
> 
> I really like the intent of this patch, but I actually find the new
> message even more confusing.

The main observation is that the current error message is given only when both interpretations (complete ident, match ident) fail, and the error message conveys only one when it should do both. I don't care about the wording either.

Show 11 quoted lines
> Is this a time when we could use hint() to give a multi-line explanation
> (and probably a matching advice.* config)? Like:
> 
>   hint: If the --author parameter contains angle brackets ("<>"), it
>   hint: is treated as a literal name/email pair to use. If not, then
>   hint: the history is searched for an existing matching author.
> 
> or something?
> 
> -Peff
> 

Well, this basically copies the man page paragraph for that option. I don't want to set a(nother) precedent for doing this and create yet another config knob.

The alternative would be to just say "Bad --author parameter '%s'" (or "Invalid..."), as we do in most cases, and force the user to check the man page for the definition of "valid". I'm beginning to prefer this minimalistic approach...

Michael
Junio C Hamano· Jan 15, 2015, 17:48 UTC · re: Michael J Gruber · lore

Re: [PATCH] commit: reword --author error message

Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 6 quoted lines
> If an --author argument is specified but does not contain a '>' then git tries
> to find the argument within the exiting authors; and gives the error
> message "No existing author found with '%s'" if there is no match.
>
> This is confusing for users who try to specify a valid complete author
> name.

I suspect that you meant s/a valid/an invalid/, as if it is valid, it cannot not contain '>' (after all, '>' is merely a rough approximation to check if it is "Name <email>" format).

> Rename the error message to make it clearer that the failure has two
> reasons in this case:
> "Bad --author parameter '%s': neither completely wellformed nor part of
> an existing one"

You are trying to help a user who thought "Who www.where.com" was a valid thing to pass to --author; "it is not completely wellformed" is not very helpful without making her realize what in that bogus string is not "completely well-formed".

Perhaps
  "--author '%s' is not 'Name <email>' and no existing author matches that string"
or somesuch?
Jeff King· Jan 16, 2015, 09:32 UTC · re: Junio C Hamano · lore

Re: [PATCH] commit: reword --author error message

On Thu, Jan 15, 2015 at 09:48:26AM -0800, Junio C Hamano wrote:
Show 15 quoted lines
> > Rename the error message to make it clearer that the failure has two
> > reasons in this case:
> > "Bad --author parameter '%s': neither completely wellformed nor part of
> > an existing one"
> 
> You are trying to help a user who thought "Who www.where.com" was a
> valid thing to pass to --author; "it is not completely wellformed"
> is not very helpful without making her realize what in that bogus
> string is not "completely well-formed".
> 
> Perhaps
> 
>   "--author '%s' is not 'Name <email>' and no existing author matches that string"
> 
> or somesuch?

Yeah, I think that is OK. It is kind of clunky to read, but it contains all of the necessary information to lead the user in the right direction.

-Peff
Junio C Hamano· Jan 16, 2015, 17:29 UTC · re: Jeff King · lore

Re: [PATCH] commit: reword --author error message

Jeff King <peff@peff.net> writes:
Show 21 quoted lines
> On Thu, Jan 15, 2015 at 09:48:26AM -0800, Junio C Hamano wrote:
>
>> > Rename the error message to make it clearer that the failure has two
>> > reasons in this case:
>> > "Bad --author parameter '%s': neither completely wellformed nor part of
>> > an existing one"
>> 
>> You are trying to help a user who thought "Who www.where.com" was a
>> valid thing to pass to --author; "it is not completely wellformed"
>> is not very helpful without making her realize what in that bogus
>> string is not "completely well-formed".
>> 
>> Perhaps
>> 
>>   "--author '%s' is not 'Name <email>' and no existing author matches that string"
>> 
>> or somesuch?
>
> Yeah, I think that is OK. It is kind of clunky to read, but it contains
> all of the necessary information to lead the user in the right
> direction.
Indeed it is clunky and not in the usual format.
This might be better, perhaps?
    die(_("--author '%s': not 'Name <email>' and matches no existing author"));
Philip Oakley· Jan 16, 2015, 18:32 UTC · re: Junio C Hamano · lore

Re: [PATCH] commit: reword --author error message

From: "Junio C Hamano" <gitster@pobox.com>
Show 34 quoted lines
> Jeff King <peff@peff.net> writes:
>
>> On Thu, Jan 15, 2015 at 09:48:26AM -0800, Junio C Hamano wrote:
>>
>>> > Rename the error message to make it clearer that the failure has 
>>> > two
>>> > reasons in this case:
>>> > "Bad --author parameter '%s': neither completely wellformed nor 
>>> > part of
>>> > an existing one"
>>>
>>> You are trying to help a user who thought "Who www.where.com" was a
>>> valid thing to pass to --author; "it is not completely wellformed"
>>> is not very helpful without making her realize what in that bogus
>>> string is not "completely well-formed".
>>>
>>> Perhaps
>>>
>>>   "--author '%s' is not 'Name <email>' and no existing author 
>>> matches that string"
>>>
>>> or somesuch?
>>
>> Yeah, I think that is OK. It is kind of clunky to read, but it 
>> contains
>> all of the necessary information to lead the user in the right
>> direction.
>
> Indeed it is clunky and not in the usual format.
>
> This might be better, perhaps?
>
>    die(_("--author '%s': not 'Name <email>' and matches no existing 
> author"));
/Bikeshed
     die(_("--author '%s': not 'Name <email>', nor matches any existing 
author"));
The 'not/and' construct didn't feel right here in the UK, but then many 
don't understand 'nor' either.
--
Philip
Eric Sunshine· Jan 16, 2015, 19:37 UTC · re: Junio C Hamano · lore

Re: [PATCH] commit: reword --author error message

On Fri, Jan 16, 2015 at 1:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> "Philip Oakley" <philipoakley@iee.org> writes:
>
>>     die(_("--author '%s': not 'Name <email>', nor matches any existing
>> author"));
>
> Sounds good.  Thanks.
To further bikeshed (particularly if "nor" is in the mix):
    neither 'Name <email>' nor a match for an existing author
Junio C Hamano· Jan 16, 2015, 19:53 UTC · re: Eric Sunshine · lore

Re: [PATCH] commit: reword --author error message

Eric Sunshine <sunshine@sunshineco.com> writes:
Show 11 quoted lines
> On Fri, Jan 16, 2015 at 1:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> "Philip Oakley" <philipoakley@iee.org> writes:
>>
>>>     die(_("--author '%s': not 'Name <email>', nor matches any existing
>>> author"));
>>
>> Sounds good.  Thanks.
>
> To further bikeshed (particularly if "nor" is in the mix):
>
>     neither 'Name <email>' nor a match for an existing author
Short and sweet ;-)
Michael J Gruber· Jan 26, 2015, 15:48 UTC · re: Junio C Hamano · lore

[PATCHv2] commit: reword --author error message

If an --author argument is specified but does not contain a '>' then git tries to find the argument within the existing authors; and gives the error message "No existing author found with '%s'" if there is no match.

This is confusing for users who try to specify a valid complete author name.

Rename the error message to make it clearer that the failure has two reasons in this case.

(This codepath is touched only when we know already that the argument cannot be a completely wellformed author ident.)

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
There's really not much by me in this patch any more...
Everyone on cc contributed - bikeshedding in its best, productive form!
BTW: How do you pull cc/msgid from the list into format-patch/send-email most effectively?
(granted that I move away from gmane/nntp, which is likely)
 builtin/commit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 7d90c35..240423b 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1056,7 +1056,7 @@ static const char *find_author_by_nickname(const char *name)
 		clear_mailmap(&mailmap);
 		return strbuf_detach(&buf, NULL);
 	}
-	die(_("No existing author found with '%s'"), name);
+	die(_("--author '%s': neither 'Name <email>' nor a match for an existing author"), name);
 }
 
 
-- 
2.3.0.rc1.222.gae238f2
Jeff King· Jan 26, 2015, 19:07 UTC · re: Michael J Gruber · lore

Re: [PATCHv2] commit: reword --author error message

On Mon, Jan 26, 2015 at 04:48:33PM +0100, Michael J Gruber wrote:
> -	die(_("No existing author found with '%s'"), name);
> +	die(_("--author '%s': neither 'Name <email>' nor a match for an existing author"), name);

I had to add to the bikeshed, but I had to read this several times to make sense of it. It is grammatically:

  X [is] neither Y nor Z

except that by eliding the verb ("is"), I somehow had trouble making sense of Z ("a match...") as a noun.

I came up with:
  --author '%s': neither 'Name <email>' nor matches an existing author

only to see that it was suggested earlier in the thread as a predecessor to this. ;)

I wonder if adding back in the missing verb, rather than a colon, would also make more sense:

  --author '%s' is neither 'Name <email>' nor a match for an existing author
> BTW: How do you pull cc/msgid from the list into format-patch/send-email most effectively?
> (granted that I move away from gmane/nntp, which is likely)
Here's what I do:
  http://article.gmane.org/gmane.comp.version-control.git/262367
-Peff
Junio C Hamano· Jan 27, 2015, 02:43 UTC · re: Jeff King · lore

Re: [PATCHv2] commit: reword --author error message

Jeff King <peff@peff.net> writes:
> ... I somehow had trouble making
> sense of Z ("a match...") as a noun.
> I wonder if adding back in the missing verb, rather than a colon, would
> also make more sense:
>
>   --author '%s' is neither 'Name <email>' nor a match for an existing author
Then
>   --author '%s' is not 'Name <email>' and matches no existing author
would be the shortest, sweetest and hopefully grammatical, perhaps?
Jeff King· Jan 27, 2015, 02:45 UTC · re: Junio C Hamano · lore

Re: [PATCHv2] commit: reword --author error message

On Mon, Jan 26, 2015 at 06:43:46PM -0800, Junio C Hamano wrote:
Show 15 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > ... I somehow had trouble making
> > sense of Z ("a match...") as a noun.
> 
> > I wonder if adding back in the missing verb, rather than a colon, would
> > also make more sense:
> >
> >   --author '%s' is neither 'Name <email>' nor a match for an existing author
> 
> Then
> 
> >   --author '%s' is not 'Name <email>' and matches no existing author
> 
> would be the shortest, sweetest and hopefully grammatical, perhaps?
Yes, that one make perfect sense to me.
-Peff
Philip Oakley· Jan 27, 2015, 07:26 UTC · re: Jeff King · lore

Re: [PATCHv2] commit: reword --author error message

From: "Jeff King" <peff@peff.net>
Show 23 quoted lines
> On Mon, Jan 26, 2015 at 06:43:46PM -0800, Junio C Hamano wrote:
>
>> Jeff King <peff@peff.net> writes:
>>
>> > ... I somehow had trouble making
>> > sense of Z ("a match...") as a noun.
>>
>> > I wonder if adding back in the missing verb, rather than a colon, 
>> > would
>> > also make more sense:
>> >
>> >   --author '%s' is neither 'Name <email>' nor a match for an 
>> > existing author
>>
>> Then
>>
>> >   --author '%s' is not 'Name <email>' and matches no existing 
>> > author
>>
>> would be the shortest, sweetest and hopefully grammatical, perhaps?
>
> Yes, that one make perfect sense to me.
>

Agreed. Philip

Ramsay Jones· Jan 27, 2015, 12:22 UTC · re: Jeff King · lore

Re: [PATCHv2] commit: reword --author error message

On 26/01/15 19:07, Jeff King wrote:
Show 25 quoted lines
> On Mon, Jan 26, 2015 at 04:48:33PM +0100, Michael J Gruber wrote:
> 
>> -	die(_("No existing author found with '%s'"), name);
>> +	die(_("--author '%s': neither 'Name <email>' nor a match for an existing author"), name);
> 
> I had to add to the bikeshed, but I had to read this several times to
> make sense of it. It is grammatically:
> 
>   X [is] neither Y nor Z
> 
> except that by eliding the verb ("is"), I somehow had trouble making
> sense of Z ("a match...") as a noun.
> 
> I came up with:
> 
>   --author '%s': neither 'Name <email>' nor matches an existing author
> 
> only to see that it was suggested earlier in the thread as a predecessor
> to this. ;)
> 
> I wonder if adding back in the missing verb, rather than a colon, would
> also make more sense:
> 
>   --author '%s' is neither 'Name <email>' nor a match for an existing author
> 
I usually don't like to add anything to the bikeshed, but ...
This sounds odd to me, so maybe:
  --author '%s' is neither in the form of 'Name <email>' nor a match for an existing author
although that is getting a bit long! :-D

ATB, Ramsay Jones

← back to recent threads