threads / discuss / 26268

Git Rebase blows away GIT_AUTHOR_NAME

Subject: Git Rebase blows away GIT_AUTHOR_NAME

## tl;dr

30 messages between Jan 12, 2011 and Jan 19, 2011.

replies: 29people: 7as markdown or json

JT Olds· Jan 12, 2011, 16:15 UTC · lore

I asked this in #git on freenode, and I've also spent a while searching the internet for anyone with any similar issues, but I can't seem to find anyone or anything that knows what's going on.

On every fresh install of Ubuntu that I have used (by default, I use ecryptfs for my home directory, which of course has its own set of silly Git errors right now), when I clone from a remote repository, have changes local to me, and changes on the remote repository, do 'git pull --rebase', occasionally my GIT_AUTHOR_NAME gets set to my GIT_AUTHOR_EMAIL on my changes that get applied on top of the remote changes.

This is incredibly frustrating, so much so that my workflow now includes running an alias to git filter-branch that fixes this.

Notable things: so far I have only had a remote server hosted by Gerrit, but I can't imagine how changes on the remote git server could possibly affect my local changes. Like I said, I'm using ecryptfs, and I'm using vanilla Git from the latest stable Ubuntu, though I've had this problem on Ubuntus for a few releases now.

Anyone have any idea why this might happen?
-JT
Jeff King· Jan 12, 2011, 18:21 UTC · re: JT Olds · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Wed, Jan 12, 2011 at 09:15:41AM -0700, JT Olds wrote:
Show 7 quoted lines
> On every fresh install of Ubuntu that I have used (by default, I use
> ecryptfs for my home directory, which of course has its own set of
> silly Git errors right now), when I clone from a remote repository,
> have changes local to me, and changes on the remote repository, do
> 'git pull --rebase', occasionally my GIT_AUTHOR_NAME gets set to my
> GIT_AUTHOR_EMAIL on my changes that get applied on top of the remote
> changes.
Weird. I have never heard of anything like it.

Some things off the top of my head: Does your GIT_AUTHOR_NAME or GIT_AUTHOR_EMAIL contain any odd characters that might confuse a parser? Do you do anything special with setting up those environment variables in your shell (e.g., in a .bashrc or .profile; those files _shouldn't_ be read by a non-interactive shell, but it's something to investigate)? For that matter, how do you set up your identity in general (by environment, or in ~/.gitconfig, or a local .git/config in each repo), and what does it contain?

Can you try running this in a repo that's giving you problems:
  . git-sh-setup
  git log --format=%H --author=your.name |
  while read rev; do
    get_author_ident_from_commit $rev
    git format-patch -1 --stdout $rev |
      git mailinfo /dev/null /dev/null
  done | less

and check that the output looks sane? I want to make sure there's nothing in your commits that is confusing our parser.

If that doesn't turn up anything, I think the next thing to try would be making a script that reproduces the problem for you, and see if I can reproduce it here.

-Peff
JT Olds· Jan 13, 2011, 17:00 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

> Some things off the top of my head: Does your GIT_AUTHOR_NAME or
> GIT_AUTHOR_EMAIL contain any odd characters that might confuse a parser?
Nah, from my .git/config
[user]
	name = JT
	email = jt@instructure.com
> Do you do anything special with setting up those environment variables
> in your shell (e.g., in a .bashrc or .profile; those files _shouldn't_
> be read by a non-interactive shell, but it's something to investigate)?

Nope, the only place in my entire home directory where those get set are in my filter-branch script to fix them, which I only run after the problem manifests itself.

> For that matter, how do you set up your identity in general (by
> environment, or in ~/.gitconfig, or a local .git/config in each repo),
> and what does it contain?
I have a global identity in ~/.gitconfig
[user]
    name = JT
    email = hello@jtolds.com
and then in particular topic branches in their .git/config like before.
Show 9 quoted lines
> Can you try running this in a repo that's giving you problems:
>
>  . git-sh-setup
>  git log --format=%H --author=your.name |
>  while read rev; do
>    get_author_ident_from_commit $rev
>    git format-patch -1 --stdout $rev |
>      git mailinfo /dev/null /dev/null
>  done | less

I don't have git-sh-setup, which seems like it should be included in the git-core package, but it's not. I have git-core 1:1.7.1-1.1ubuntu0.1 installed. Obviously this precludes get_author_ident_from_commit from working.

> If that doesn't turn up anything, I think the next thing to try would be
> making a script that reproduces the problem for you, and see if I can
> reproduce it here.
Alright, I'll see what I can do. Thanks.
JT Olds· Jan 13, 2011, 17:11 UTC · re: JT Olds · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

I got a copy of git-sh-setup. All of my commits (that have either worked or that I fixed) look like this:

GIT_AUTHOR_NAME='JT'
GIT_AUTHOR_EMAIL='jt@instructure.com'
GIT_AUTHOR_DATE='1294756950 -0700'
Author: jt@instructure.com
Email: jt@instructure.com
Subject: removing nondeterminism from test
Date: Tue, 11 Jan 2011 07:42:30 -0700

Should "Author" be my name? Could that be what's going on? I don't even know where that gets set. The ones that I failed to notice that they broke before I pushed them look like this:

GIT_AUTHOR_NAME='jt@instructure.com'
GIT_AUTHOR_EMAIL='jt@instructure.com'
GIT_AUTHOR_DATE='1294775987 -0700'
Author: jt@instructure.com
Email: jt@instructure.com
Subject: some cleanup
Date: Tue, 11 Jan 2011 12:59:47 -0700

Thanks again for the help. This has been frustrating me for months. Still working on a duplicate-the-problem script.

-JT
On Thu, Jan 13, 2011 at 10:00 AM, JT Olds <jtolds@xnet5.com> wrote:
Show 50 quoted lines
>> Some things off the top of my head: Does your GIT_AUTHOR_NAME or
>> GIT_AUTHOR_EMAIL contain any odd characters that might confuse a parser?
>
> Nah, from my .git/config
>
> [user]
>        name = JT
>        email = jt@instructure.com
>
>> Do you do anything special with setting up those environment variables
>> in your shell (e.g., in a .bashrc or .profile; those files _shouldn't_
>> be read by a non-interactive shell, but it's something to investigate)?
>
> Nope, the only place in my entire home directory where those get set
> are in my filter-branch script to fix them, which I only run after the
> problem manifests itself.
>
>> For that matter, how do you set up your identity in general (by
>> environment, or in ~/.gitconfig, or a local .git/config in each repo),
>> and what does it contain?
>
> I have a global identity in ~/.gitconfig
>
> [user]
>    name = JT
>    email = hello@jtolds.com
>
> and then in particular topic branches in their .git/config like before.
>
>> Can you try running this in a repo that's giving you problems:
>>
>>  . git-sh-setup
>>  git log --format=%H --author=your.name |
>>  while read rev; do
>>    get_author_ident_from_commit $rev
>>    git format-patch -1 --stdout $rev |
>>      git mailinfo /dev/null /dev/null
>>  done | less
>
> I don't have git-sh-setup, which seems like it should be included in
> the git-core package, but it's not. I have git-core
> 1:1.7.1-1.1ubuntu0.1 installed. Obviously this precludes
> get_author_ident_from_commit from working.
>
>> If that doesn't turn up anything, I think the next thing to try would be
>> making a script that reproduces the problem for you, and see if I can
>> reproduce it here.
>
> Alright, I'll see what I can do. Thanks.
>
Erik Faye-Lund· Jan 13, 2011, 17:47 UTC · re: JT Olds · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Thu, Jan 13, 2011 at 6:11 PM, JT Olds <jtolds@xnet5.com> wrote:
Show 15 quoted lines
> I got a copy of git-sh-setup. All of my commits (that have either
> worked or that I fixed) look like this:
>
> GIT_AUTHOR_NAME='JT'
> GIT_AUTHOR_EMAIL='jt@instructure.com'
> GIT_AUTHOR_DATE='1294756950 -0700'
> Author: jt@instructure.com
> Email: jt@instructure.com
> Subject: removing nondeterminism from test
> Date: Tue, 11 Jan 2011 07:42:30 -0700
>
> Should "Author" be my name? Could that be what's going on? I don't
> even know where that gets set. The ones that I failed to notice that
> they broke before I pushed them look like this:
>

"git am" (which git rebase builds on) requires the author name to be at least three characters long. This is a problem that has been discussed before, see <AANLkTinqTL7gH4CHEfy8UrhK13xcO_3UzgIyQka00MAh@mail.gmail.com>:

http://mid.gmane.org/AANLkTinqTL7gH4CHEfy8UrhK13xcO_3UzgIyQka00MAh@mail.gmail.com
JT Olds· Jan 13, 2011, 17:52 UTC · re: Erik Faye-Lund · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

Oh thank you Erik, it's great to just know what the problem is. I've been feeling like some voodoo was happening.

What are the chances of decreasing that lower bound of author name size? :)
-JT
On Thu, Jan 13, 2011 at 10:47 AM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 24 quoted lines
> On Thu, Jan 13, 2011 at 6:11 PM, JT Olds <jtolds@xnet5.com> wrote:
>> I got a copy of git-sh-setup. All of my commits (that have either
>> worked or that I fixed) look like this:
>>
>> GIT_AUTHOR_NAME='JT'
>> GIT_AUTHOR_EMAIL='jt@instructure.com'
>> GIT_AUTHOR_DATE='1294756950 -0700'
>> Author: jt@instructure.com
>> Email: jt@instructure.com
>> Subject: removing nondeterminism from test
>> Date: Tue, 11 Jan 2011 07:42:30 -0700
>>
>> Should "Author" be my name? Could that be what's going on? I don't
>> even know where that gets set. The ones that I failed to notice that
>> they broke before I pushed them look like this:
>>
>
> "git am" (which git rebase builds on) requires the author name to be
> at least three characters long. This is a problem that has been
> discussed before, see
> <AANLkTinqTL7gH4CHEfy8UrhK13xcO_3UzgIyQka00MAh@mail.gmail.com>:
>
> http://mid.gmane.org/AANLkTinqTL7gH4CHEfy8UrhK13xcO_3UzgIyQka00MAh@mail.gmail.com
>
Erik Faye-Lund· Jan 13, 2011, 18:20 UTC · re: JT Olds · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

In the future please don't top-post, as it makes the discussion harder for other people to follow. I've fixed the quoting for now, though.

On Thu, Jan 13, 2011 at 6:52 PM, JT Olds <jtolds@xnet5.com> wrote:
Show 31 quoted lines
> On Thu, Jan 13, 2011 at 10:47 AM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Thu, Jan 13, 2011 at 6:11 PM, JT Olds <jtolds@xnet5.com> wrote:
>>> I got a copy of git-sh-setup. All of my commits (that have either
>>> worked or that I fixed) look like this:
>>>
>>> GIT_AUTHOR_NAME='JT'
>>> GIT_AUTHOR_EMAIL='jt@instructure.com'
>>> GIT_AUTHOR_DATE='1294756950 -0700'
>>> Author: jt@instructure.com
>>> Email: jt@instructure.com
>>> Subject: removing nondeterminism from test
>>> Date: Tue, 11 Jan 2011 07:42:30 -0700
>>>
>>> Should "Author" be my name? Could that be what's going on? I don't
>>> even know where that gets set. The ones that I failed to notice that
>>> they broke before I pushed them look like this:
>>>
>>
>> "git am" (which git rebase builds on) requires the author name to be
>> at least three characters long. This is a problem that has been
>> discussed before, see
>> <AANLkTinqTL7gH4CHEfy8UrhK13xcO_3UzgIyQka00MAh@mail.gmail.com>:
>>
>> http://mid.gmane.org/AANLkTinqTL7gH4CHEfy8UrhK13xcO_3UzgIyQka00MAh@mail.gmail.com
>>
>
> Oh thank you Erik, it's great to just know what the problem is. I've
> been feeling like some voodoo was happening.
>
> What are the chances of decreasing that lower bound of author name size? :)
>

It's a matter of editing the function called "get_sane_name" in builtin/mailinfo.c.

But simply changing the bound doesn't mean you're in the clear. If any other people you work with end up rebasing any patches you've written, the same problem will manifest. There's a lot of people using some really old versions of Git.

And then it's the question of why this is done in the first place. I don't know, but I suspect Linus has his reasons. Besides, a name of two characters aren't really sane. You'd need at least three characters to form a first/last name pair.

I'd recommend that you use a longer name, really.
Tor Arntsen· Jan 14, 2011, 08:45 UTC · re: Erik Faye-Lund · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Thu, Jan 13, 2011 at 19:20, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>[..] Besides, a name of
> two characters aren't really sane. You'd need at least three
> characters to form a first/last name pair.

I think I've mentioned this before in another thread, but first/last name isn't universal, not even within countries where it's the common form. When I was as student there was a fellow student from another scandinavian country and his legal, full name consisted of a single letter.

-Tor
Erik Faye-Lund· Jan 14, 2011, 08:56 UTC · re: Tor Arntsen · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 9:45 AM, Tor Arntsen <tor@spacetec.no> wrote:
Show 11 quoted lines
> On Thu, Jan 13, 2011 at 19:20, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>>[..] Besides, a name of
>> two characters aren't really sane. You'd need at least three
>> characters to form a first/last name pair.
>
> I think I've mentioned this before in another thread, but first/last
> name isn't universal, not even within countries where it's the common
> form. When I was as student there was a fellow student from another
> scandinavian country and his legal, full name consisted of a single
> letter.
>

I'm curious, what Scandinavian country was this? Because as a Norwegian, I know a lot of people from all Scandinavian country, yet I've never heard of such names. In Norway, I the shortest legal name I've ever heard of was five characters.

Tor Arntsen· Jan 14, 2011, 09:24 UTC · re: Erik Faye-Lund · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 09:56, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 12 quoted lines
> On Fri, Jan 14, 2011 at 9:45 AM, Tor Arntsen <tor@spacetec.no> wrote:
>> I think I've mentioned this before in another thread, but first/last
>> name isn't universal, not even within countries where it's the common
>> form. When I was as student there was a fellow student from another
>> scandinavian country and his legal, full name consisted of a single
>> letter.
>>
>
> I'm curious, what Scandinavian country was this? Because as a
> Norwegian, I know a lot of people from all Scandinavian country, yet
> I've never heard of such names. In Norway, I the shortest legal name
> I've ever heard of was five characters.

Sweden (I'm Norwegian too - this guy was a Swede studying in Norway). Admittedly I have only that single example, and it was back in the late seventies. His name was accepted as legal by Statens Lånekasse (bank for students) and when the loans arrived his single-letter name would be found at the very end of the long lists of wide listing-paper printouts from the bank that was stiched up on the billboard wall outside the administration offices. The loans arrived a couple of times per year but we always had to go looking - the rest of us were just amazed that we could really find that single letter down there and he wasn't bs'ing the rest of us about his name.

I'm not sure why there's a 3-letter limit on git author names.. but I would suggest it should be set down to 1 letter minimum.. below that would, I think, be overdoing it..

-Tor
Erik Faye-Lund· Jan 14, 2011, 09:53 UTC · re: Tor Arntsen · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

(CC'ed Linus, as he wrote mailinfo's sanity-checking)
On Fri, Jan 14, 2011 at 10:24 AM, Tor Arntsen <tor@spacetec.no> wrote:
Show 29 quoted lines
> On Fri, Jan 14, 2011 at 09:56, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Fri, Jan 14, 2011 at 9:45 AM, Tor Arntsen <tor@spacetec.no> wrote:
>>> I think I've mentioned this before in another thread, but first/last
>>> name isn't universal, not even within countries where it's the common
>>> form. When I was as student there was a fellow student from another
>>> scandinavian country and his legal, full name consisted of a single
>>> letter.
>>>
>>
>> I'm curious, what Scandinavian country was this? Because as a
>> Norwegian, I know a lot of people from all Scandinavian country, yet
>> I've never heard of such names. In Norway, I the shortest legal name
>> I've ever heard of was five characters.
>
> Sweden (I'm Norwegian too - this guy was a Swede studying in Norway).
> Admittedly I have only that single example, and it was back in the
> late seventies. His name was accepted as legal by Statens Lånekasse
> (bank for students) and when the loans arrived his single-letter name
> would be found at the very end of the long lists of wide listing-paper
> printouts from the bank that was stiched up on the billboard wall
> outside the administration offices. The loans arrived a couple of
> times per year but we always had to go looking - the rest of us were
> just amazed that we could really find that single letter down there
> and he wasn't bs'ing the rest of us about his name.
>
> I'm not sure why there's a 3-letter limit on git author names.. but I
> would suggest it should be set down to 1 letter minimum.. below that
> would, I think, be overdoing it..
>

Linus, you wrote sanity_check (from 2744b23). Do you remember if there were any specific reason for the minimum length of 3 of an author-name? It seems that in Sweden, legal names can be even a single letter (see Tor's comment)...

JT Olds· Jan 14, 2011, 14:51 UTC · re: Erik Faye-Lund · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 2:53 AM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 38 quoted lines
> (CC'ed Linus, as he wrote mailinfo's sanity-checking)
>
> On Fri, Jan 14, 2011 at 10:24 AM, Tor Arntsen <tor@spacetec.no> wrote:
>> On Fri, Jan 14, 2011 at 09:56, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>>> On Fri, Jan 14, 2011 at 9:45 AM, Tor Arntsen <tor@spacetec.no> wrote:
>>>> I think I've mentioned this before in another thread, but first/last
>>>> name isn't universal, not even within countries where it's the common
>>>> form. When I was as student there was a fellow student from another
>>>> scandinavian country and his legal, full name consisted of a single
>>>> letter.
>>>>
>>>
>>> I'm curious, what Scandinavian country was this? Because as a
>>> Norwegian, I know a lot of people from all Scandinavian country, yet
>>> I've never heard of such names. In Norway, I the shortest legal name
>>> I've ever heard of was five characters.
>>
>> Sweden (I'm Norwegian too - this guy was a Swede studying in Norway).
>> Admittedly I have only that single example, and it was back in the
>> late seventies. His name was accepted as legal by Statens Lånekasse
>> (bank for students) and when the loans arrived his single-letter name
>> would be found at the very end of the long lists of wide listing-paper
>> printouts from the bank that was stiched up on the billboard wall
>> outside the administration offices. The loans arrived a couple of
>> times per year but we always had to go looking - the rest of us were
>> just amazed that we could really find that single letter down there
>> and he wasn't bs'ing the rest of us about his name.
>>
>> I'm not sure why there's a 3-letter limit on git author names.. but I
>> would suggest it should be set down to 1 letter minimum.. below that
>> would, I think, be overdoing it..
>>
>
> Linus, you wrote sanity_check (from 2744b23). Do you remember if there
> were any specific reason for the minimum length of 3 of an
> author-name? It seems that in Sweden, legal names can be even a single
> letter (see Tor's comment)...
>
Thanks all.

I suppose another question, regardless of the outcome of following up on the name limit, is how come this is silently swallowed?

Linus Torvalds· Jan 14, 2011, 15:41 UTC · re: Erik Faye-Lund · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 1:53 AM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 5 quoted lines
>
> Linus, you wrote sanity_check (from 2744b23). Do you remember if there
> were any specific reason for the minimum length of 3 of an
> author-name? It seems that in Sweden, legal names can be even a single
> letter (see Tor's comment)...

Even if the legal name would be a single letter, you'd still need to have a surname.

The three-letter minimum is just a sanity check. If your name really is even just three letters, I suspect you're just lying. I don't know of anybody named "A B".

That thing is supposed to be a *NAME*. Not shorthand. Not your first name. Not your nickname. If you have a nickname, put it in quotes inside the real name.

I've seen too many broken source control systems that just take your login as a name *cough*CVS*cough*, and then people think it's "convenient" and "cool" to have a short name.

It's not convenient. It's not cool. It's just shorthand where shorthand doesn't help. Then you end up using it in a public setting, and suddenly your cool shorthand or nickname isn't even remotely unique.

No, there is no uniquness "requirements" for the name, but come on. Look at shortlog output some day. We try to use just the name because it looks better. But if people don't use their full name, it just looks _stupid_

                                    Linus
Erik Faye-Lund· Jan 14, 2011, 16:13 UTC · re: Linus Torvalds · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 4:41 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote:

Show 10 quoted lines
> On Fri, Jan 14, 2011 at 1:53 AM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>>
>> Linus, you wrote sanity_check (from 2744b23). Do you remember if there
>> were any specific reason for the minimum length of 3 of an
>> author-name? It seems that in Sweden, legal names can be even a single
>> letter (see Tor's comment)...
>
> Even if the legal name would be a single letter, you'd still need to
> have a surname.
>

I think Tor pointed out that he knew a swede with his full legal name to be only one letter long. I would suppose that meant that he didn't have a surename?

> The three-letter minimum is just a sanity check. If your name really
> is even just three letters, I suspect you're just lying. I don't know
> of anybody named "A B".
>

Thanks for clarifying that it's not there for a technical reason. The thing is, git-am seems to be the only place where such a sanity-check is performed. Shouldn't git-commit rather perform such checks also (if such a check should be done at all), perhaps with an override similar to --allow-empty? And on top of all it doesn't barf, it just silently replace the name with the e-mail...

Show 17 quoted lines
> That thing is supposed to be a *NAME*. Not shorthand. Not your first
> name. Not your nickname. If you have a nickname, put it in quotes
> inside the real name.
>
> I've seen too many broken source control systems that just take your
> login as a name *cough*CVS*cough*, and then people think it's
> "convenient" and "cool" to have a short name.
>
> It's not convenient. It's not cool. It's just shorthand where
> shorthand doesn't help. Then you end up using it in a public setting,
> and suddenly your cool shorthand or nickname isn't even remotely
> unique.
>
> No, there is no uniquness "requirements" for the name, but come on.
> Look at shortlog output some day. We try to use just the name because
> it looks better. But if people don't use their full name, it just
> looks _stupid_

I agree with you that using nicknames etc as author-name is a bit silly, but I'm not sure if I want my version control system to tell me that it thinks my author-name looks stupid :)

IMO, we should probably just remove the check altogether.

There's also an upper-bound of 60 characters. I'm wondering if this could be hit by valid names, especially with non-western UTF-8 characters. Perhaps this should be removed also. The check for '@', '<' and '>' is probably still OK.

Jeff King· Jan 14, 2011, 16:21 UTC · re: Erik Faye-Lund · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 05:13:59PM +0100, Erik Faye-Lund wrote:
Show 10 quoted lines
> > The three-letter minimum is just a sanity check. If your name really
> > is even just three letters, I suspect you're just lying. I don't know
> > of anybody named "A B".
> >
> Thanks for clarifying that it's not there for a technical reason. The
> thing is, git-am seems to be the only place where such a sanity-check
> is performed. Shouldn't git-commit rather perform such checks also (if
> such a check should be done at all), perhaps with an override similar
> to --allow-empty? And on top of all it doesn't barf, it just silently
> replace the name with the e-mail...

I tend to agree with Linus on the stupidity issue, but I do worry about the subtlety of the results. It causes silent data corruption during a rebase (or when somebody is applying an emailed patch). On the other hand, I do understand why Linus made a sanity check in the first place; his use case is to deal with whatever crap people happen to mail him, whether they have used git or not.

So we should probably do one or both of:
  1. Make an --allow-any-name option to mailinfo, and use it when we
     invoke mailinfo internally for rebasing. That still doesn't solve
     the emailed patch problem, but at least keeps purely internal
     operations sane.
  2. Bump the check up to git-commit time, which is the best place to
     catch and tell somebody that their name is too short, because they
     can actually fix it.

Even if we dropped the check now, option (2) is still useful, because you have no idea which version of git the other end will use to apply your patch.

-Peff
Erik Faye-Lund· Jan 14, 2011, 16:30 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 5:21 PM, Jeff King <peff@peff.net> wrote:
Show 31 quoted lines
> On Fri, Jan 14, 2011 at 05:13:59PM +0100, Erik Faye-Lund wrote:
>
>> > The three-letter minimum is just a sanity check. If your name really
>> > is even just three letters, I suspect you're just lying. I don't know
>> > of anybody named "A B".
>> >
>> Thanks for clarifying that it's not there for a technical reason. The
>> thing is, git-am seems to be the only place where such a sanity-check
>> is performed. Shouldn't git-commit rather perform such checks also (if
>> such a check should be done at all), perhaps with an override similar
>> to --allow-empty? And on top of all it doesn't barf, it just silently
>> replace the name with the e-mail...
>
> I tend to agree with Linus on the stupidity issue, but I do worry about
> the subtlety of the results. It causes silent data corruption during a
> rebase (or when somebody is applying an emailed patch). On the other
> hand, I do understand why Linus made a sanity check in the first place;
> his use case is to deal with whatever crap people happen to mail him,
> whether they have used git or not.
>
> So we should probably do one or both of:
>
>  1. Make an --allow-any-name option to mailinfo, and use it when we
>     invoke mailinfo internally for rebasing. That still doesn't solve
>     the emailed patch problem, but at least keeps purely internal
>     operations sane.
>
>  2. Bump the check up to git-commit time, which is the best place to
>     catch and tell somebody that their name is too short, because they
>     can actually fix it.
>

The problem with (2) is that git-am uses git-commit-tree rather than git-commit. But I do think that adding the same checks to git-commit would make sense. Unless we decide to remove the checks, that is...

Jeff King· Jan 14, 2011, 16:33 UTC · re: Erik Faye-Lund · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 05:30:51PM +0100, Erik Faye-Lund wrote:
Show 8 quoted lines
> >  2. Bump the check up to git-commit time, which is the best place to
> >     catch and tell somebody that their name is too short, because they
> >     can actually fix it.
> >
> 
> The problem with (2) is that git-am uses git-commit-tree rather than
> git-commit. But I do think that adding the same checks to git-commit
> would make sense. Unless we decide to remove the checks, that is...

Yeah, I didn't say it very clearly, but I meant to factor the check out and use it also in git-commit (probably as a warning, the same way we do with other ident verification in print_summary().

Even if we remove the check, it may still be worthwhile to say "Just so you know, older versions of git may mangle the name you have chosen".

-Peff
Jay Soffian· Jan 14, 2011, 18:02 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 11:33 AM, Jeff King <peff@peff.net> wrote:
> Even if we remove the check, it may still be worthwhile to say "Just so
> you know, older versions of git may mangle the name you have chosen".

I knew this conversation sounded familiar. It came up before in a different context:

http://thread.gmane.org/gmane.comp.version-control.git/150871/focus=150902
j.
Junio C Hamano· Jan 14, 2011, 18:28 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> So we should probably do one or both of:
>
>   1. Make an --allow-any-name option to mailinfo, and use it when we
>      invoke mailinfo internally for rebasing. That still doesn't solve
>      the emailed patch problem, but at least keeps purely internal
>      operations sane.
>
>   2. Bump the check up to git-commit time, which is the best place to
>      catch and tell somebody that their name is too short, because they
>      can actually fix it.
>
> Even if we dropped the check now, option (2) is still useful, because
> you have no idea which version of git the other end will use to apply
> your patch.

I am perfectly Ok with making the check looser in "am" when $rebasing is in effect. Wouldn't that solve the issue?

Jeff King· Jan 14, 2011, 20:07 UTC · re: Junio C Hamano · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 10:28:58AM -0800, Junio C Hamano wrote:
Show 19 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > So we should probably do one or both of:
> >
> >   1. Make an --allow-any-name option to mailinfo, and use it when we
> >      invoke mailinfo internally for rebasing. That still doesn't solve
> >      the emailed patch problem, but at least keeps purely internal
> >      operations sane.
> >
> >   2. Bump the check up to git-commit time, which is the best place to
> >      catch and tell somebody that their name is too short, because they
> >      can actually fix it.
> >
> > Even if we dropped the check now, option (2) is still useful, because
> > you have no idea which version of git the other end will use to apply
> > your patch.
> 
> I am perfectly Ok with making the check looser in "am" when $rebasing is
> in effect.  Wouldn't that solve the issue?

More or less. You would still have some lossiness when emailing your patch. Do we want to warn about that?

-Peff
Junio C Hamano· Jan 14, 2011, 22:30 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

Jeff King <peff@peff.net> writes:
> More or less. You would still have some lossiness when emailing your
> patch. Do we want to warn about that?
Probably not.

There will only be less than hundred people with a single letter name in the world (I was tempted to say 26 but decided to be generous ;-) like that, and you will much more likely to see an overly short "name" part from a misconfiguration or misparsing than from receiving a real patch from people with such a name.

But I haven't thought the issues, possible improvements and pros-and-cons through.

Jeff King· Jan 17, 2011, 22:21 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 11:21:45AM -0500, Jeff King wrote:
Show 6 quoted lines
> So we should probably do one or both of:
> 
>   1. Make an --allow-any-name option to mailinfo, and use it when we
>      invoke mailinfo internally for rebasing. That still doesn't solve
>      the emailed patch problem, but at least keeps purely internal
>      operations sane.

So I wrote up a nice tidy patch series with mailinfo changes and tests, and then am/rebase changes and tests on top of that. And guess what I noticed? My rebase tests didn't actually fail with stock git.

I bisected to 43c2325 (am: use get_author_ident_from_commit instead of mailinfo when rebasing, 2010-06-16), which was written to handle exactly this sort of thing.

That commit made it into v1.7.2. JT, which version of git are you running? Do you still see any problems with v1.7.2 and above? I can't replicate your issue with more recent versions.

So unless we want to do any sort of commit-time warning, I don't think there is anything left to be done on this topic.

-Peff
Erik Faye-Lund· Jan 17, 2011, 22:29 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Mon, Jan 17, 2011 at 11:21 PM, Jeff King <peff@peff.net> wrote:
Show 17 quoted lines
> On Fri, Jan 14, 2011 at 11:21:45AM -0500, Jeff King wrote:
>
>> So we should probably do one or both of:
>>
>>   1. Make an --allow-any-name option to mailinfo, and use it when we
>>      invoke mailinfo internally for rebasing. That still doesn't solve
>>      the emailed patch problem, but at least keeps purely internal
>>      operations sane.
>
> So I wrote up a nice tidy patch series with mailinfo changes and tests,
> and then am/rebase changes and tests on top of that. And guess what I
> noticed? My rebase tests didn't actually fail with stock git.
>
> I bisected to 43c2325 (am: use get_author_ident_from_commit instead of
> mailinfo when rebasing, 2010-06-16), which was written to handle exactly
> this sort of thing.
>
Heh, same story bro :(

Just for reference, my patch can be found at http://repo.or.cz/w/git/kusma.git work/rebase-keep-name

JT Olds· Jan 18, 2011, 03:55 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Mon, Jan 17, 2011 at 3:21 PM, Jeff King <peff@peff.net> wrote:
Show 26 quoted lines
> On Fri, Jan 14, 2011 at 11:21:45AM -0500, Jeff King wrote:
>
>> So we should probably do one or both of:
>>
>>   1. Make an --allow-any-name option to mailinfo, and use it when we
>>      invoke mailinfo internally for rebasing. That still doesn't solve
>>      the emailed patch problem, but at least keeps purely internal
>>      operations sane.
>
> So I wrote up a nice tidy patch series with mailinfo changes and tests,
> and then am/rebase changes and tests on top of that. And guess what I
> noticed? My rebase tests didn't actually fail with stock git.
>
> I bisected to 43c2325 (am: use get_author_ident_from_commit instead of
> mailinfo when rebasing, 2010-06-16), which was written to handle exactly
> this sort of thing.
>
> That commit made it into v1.7.2. JT, which version of git are you
> running? Do you still see any problems with v1.7.2 and above? I can't
> replicate your issue with more recent versions.
>
> So unless we want to do any sort of commit-time warning, I don't think
> there is anything left to be done on this topic.
>
> -Peff
>

Oh ho! No, I am running 1.7.1. I was so pleased to find out what the root of the problem was, though, that I did go and add my last name and haven't had any trouble since.

Thanks for all your help everyone.
-JT
Jay Soffian· Jan 19, 2011, 01:33 UTC · re: Jeff King · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Mon, Jan 17, 2011 at 5:21 PM, Jeff King <peff@peff.net> wrote:
> I bisected to 43c2325 (am: use get_author_ident_from_commit instead of
> mailinfo when rebasing, 2010-06-16), which was written to handle exactly
> this sort of thing.

Wow. Well, I apologize for not short-circuiting this thread much sooner, but believe it or not, I didn't even remember writing that till you just pointed it out. I'm too young to be losing my memory. :-(

j.
Tor Arntsen· Jan 14, 2011, 16:21 UTC · re: Linus Torvalds · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On 14/01/2011 17:13, Erik Faye-Lund wrote:
> I think Tor pointed out that he knew a swede with his full legal name
> to be only one letter long. I would suppose that meant that he didn't
> have a surename?

Exactly. He didn't. Bank printouts etc. would only have that single letter, he didn't use a nickname - that letter was his legal name.

As for the rest of the world - I don't think the first name/last name combo (almost) everyone in the west use is necessarily a universal rule.

-Tor
Erik Faye-Lund· Jan 14, 2011, 16:26 UTC · re: Tor Arntsen · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 5:21 PM, Tor Arntsen <tor@spacetec.no> wrote:
Show 9 quoted lines
> On 14/01/2011 17:13, Erik Faye-Lund wrote:
>
>> I think Tor pointed out that he knew a swede with his full legal name
>> to be only one letter long. I would suppose that meant that he didn't
>> have a surename?
>
> Exactly. He didn't. Bank printouts etc. would only have that single
> letter, he didn't use a nickname - that letter was his legal name.
>

Perhaps he could have spelled it out like he usually have to do: "The artist formerly known as Prince" ;)

Linus Torvalds· Jan 14, 2011, 17:18 UTC · re: Tor Arntsen · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Fri, Jan 14, 2011 at 8:21 AM, Tor Arntsen <tor@spacetec.no> wrote:
Show 11 quoted lines
> On 14/01/2011 17:13, Erik Faye-Lund wrote:
>
>> I think Tor pointed out that he knew a swede with his full legal name
>> to be only one letter long. I would suppose that meant that he didn't
>> have a surename?
>
> Exactly. He didn't. Bank printouts etc. would only have that single
> letter, he didn't use a nickname - that letter was his legal name.
>
> As for the rest of the world - I don't think the first name/last name combo
> (almost) everyone in the west use is necessarily a universal rule.

Quite frankly, I'd suggest that person then use "The letter 'G'" as his/her git name.

git names aren't "legal names". They are for informational purposes.
And a single letter just isn't informational.
                Linus
Erik Faye-Lund· Jan 14, 2011, 09:55 UTC · re: Tor Arntsen · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

(CC'ed Linus, as he wrote mailinfo's sanity-checking -- sorry, forgot to actually CC him the first time) On Fri, Jan 14, 2011 at 10:24 AM, Tor Arntsen <tor@spacetec.no> wrote:

Show 29 quoted lines
> On Fri, Jan 14, 2011 at 09:56, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Fri, Jan 14, 2011 at 9:45 AM, Tor Arntsen <tor@spacetec.no> wrote:
>>> I think I've mentioned this before in another thread, but first/last
>>> name isn't universal, not even within countries where it's the common
>>> form. When I was as student there was a fellow student from another
>>> scandinavian country and his legal, full name consisted of a single
>>> letter.
>>>
>>
>> I'm curious, what Scandinavian country was this? Because as a
>> Norwegian, I know a lot of people from all Scandinavian country, yet
>> I've never heard of such names. In Norway, I the shortest legal name
>> I've ever heard of was five characters.
>
> Sweden (I'm Norwegian too - this guy was a Swede studying in Norway).
> Admittedly I have only that single example, and it was back in the
> late seventies. His name was accepted as legal by Statens Lånekasse
> (bank for students) and when the loans arrived his single-letter name
> would be found at the very end of the long lists of wide listing-paper
> printouts from the bank that was stiched up on the billboard wall
> outside the administration offices. The loans arrived a couple of
> times per year but we always had to go looking - the rest of us were
> just amazed that we could really find that single letter down there
> and he wasn't bs'ing the rest of us about his name.
>
> I'm not sure why there's a 3-letter limit on git author names.. but I
> would suggest it should be set down to 1 letter minimum.. below that
> would, I think, be overdoing it..
>

Linus, you wrote sanity_check (from 2744b23). Do you remember if there were any specific reason for the minimum length of 3 of an author-name? It seems that in Sweden, legal names can be even a single letter (see Tor's comment)...

Jeff King· Jan 13, 2011, 18:47 UTC · re: JT Olds · lore

Re: Git Rebase blows away GIT_AUTHOR_NAME

On Thu, Jan 13, 2011 at 10:00:45AM -0700, JT Olds wrote:
> I don't have git-sh-setup, which seems like it should be included in
> the git-core package, but it's not. I have git-core
> 1:1.7.1-1.1ubuntu0.1 installed. Obviously this precludes
> get_author_ident_from_commit from working.

Oops, sorry about that. It ships in the /usr/lib/git-core directory these days (it _used_ to ship in /usr/bin, so "." would find it automatically). And when I did my test, I was using the git repository itself, so of course it was in my current directory then. :)

But it looks like you found it.
Show 8 quoted lines
> Author: jt@instructure.com
> Email: jt@instructure.com
> Subject: removing nondeterminism from test
> Date: Tue, 11 Jan 2011 07:42:30 -0700
> 
> Should "Author" be my name? Could that be what's going on? I don't
> even know where that gets set. The ones that I failed to notice that
> they broke before I pushed them look like this:

Yep, it should be your name. So my next to suspect would be the git-mailinfo parser, and indeed, that's the thing that has the 3-character limit that Erik mentioned.

So that's definitely the problem.
-Peff

← back to recent threads