commit --amend --author error

8 messages, 3 authors, 2016-06-15 · open the first message on its own page

commit --amend --author error

From: Gunnar Wagner <hidden>
Date: 2016-06-15 23:03:28

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?

Re: commit --amend --author error

From: Michael J Gruber <hidden>
Date: 2016-06-15 23:03:28

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

Michael

Re: commit --amend --author error

From: Jeff King <hidden>
Date: 2016-06-15 23:03:28

On Tue, Jan 13, 2015 at 12:24:18PM +0100, Michael J Gruber wrote:
Gunnar Wagner schrieb am 13.01.2015 um 09:15:
quoted
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 [off-list ref]

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

Re: commit --amend --author error

From: Michael J Gruber <hidden>
Date: 2016-06-15 23:03:35

Jeff King schrieb am 14.01.2015 um 13:09:
On Tue, Jan 13, 2015 at 12:24:18PM +0100, Michael J Gruber wrote:
quoted
Gunnar Wagner schrieb am 13.01.2015 um 09:15:
quoted
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 [off-list ref]
(git commit --allow-almost-empty in the case of that author, hum)
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

[PATCH] commit: reword --author error message

From: Michael J Gruber <hidden>
Date: 2016-06-15 23:03:35

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

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

From: Michael J Gruber <hidden>
Date: 2016-06-15 23:03:35

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?
quoted hunk
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 <redacted>
---
 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);
 }
 
 

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

From: Jeff King <hidden>
Date: 2016-06-15 23:03:35

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.

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

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

From: Michael J Gruber <hidden>
Date: 2016-06-15 23:03:35

Jeff King schrieb am 15.01.2015 um 15:31:
On Thu, Jan 15, 2015 at 03:23:08PM +0100, Michael J Gruber wrote:
quoted
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.
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help