git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?
@ 2012-09-01 15:34 Ævar Arnfjörð Bjarmason
  2012-09-01 15:57 ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2012-09-01 15:34 UTC (permalink / raw)
  To: Git Mailing List

Maybe this is documented in some place I didn't spot, but I expected
that when I set GIT_AUTHOR_{NAME,EMAIL} it would affect the operation
of git-tag, but it doesn't seem to. When I create tags it seems to
completely ignore those variables.

Should it be doing that? Here's a test script demonstrating the issue:

    #!/bin/sh -e
    # Set defaults
    git config --global user.name "Ævar Arnfjörð Bjarmason"
    git config --global user.email "avarab@gmail.com"

    rm -rf /tmp/test-git
    git init /tmp/test-git
    cd /tmp/test-git

    make_commit() {
        file=$1
        content=$2
        echo $content >$file
        git add $file
        git commit -m"$file: $content" $file
        git --no-pager log -1 HEAD | grep ^Author
    }

    make_commit README "testing content"
    git config user.name "Test User"
    git config user.email "test@example.com"
    make_commit README "testing content again"
    git tag -a -m"annotated tag" tag-name-1
    git --no-pager show tag-name-1 | grep ^Author

    GIT_AUTHOR_NAME="Tag Test User"
GIT_AUTHOR_EMAIL="tagtest@example.com" git tag -a -m"another annotated
tag" tag-name-2
    git --no-pager show tag-name-2 | grep ^Author

Which outputs:

    $ sh /tmp/test-tag.sh
    Initialized empty Git repository in /tmp/test-git/.git/
    [master (root-commit) 9816756] README: testing content
     1 file changed, 1 insertion(+)
     create mode 100644 README
    Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    [master 304b71e] README: testing content again
     1 file changed, 1 insertion(+), 1 deletion(-)
    Author: Test User <test@example.com>
    Author: Test User <test@example.com>
    Author: Test User <test@example.com>

I'd expect references to "Tag Test User <tagtest@example.com>" for the
second tag I created.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?
  2012-09-01 15:34 Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email? Ævar Arnfjörð Bjarmason
@ 2012-09-01 15:57 ` Andreas Schwab
  2012-09-01 16:06   ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2012-09-01 15:57 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Git Mailing List

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

>     git --no-pager show tag-name-1 | grep ^Author

A tag doesn't have an author, it has a tagger.  This shows the author of
the *commit*.

>     GIT_AUTHOR_NAME="Tag Test User"
> GIT_AUTHOR_EMAIL="tagtest@example.com" git tag -a -m"another annotated
> tag" tag-name-2

The tagger is controlled by the committer info.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?
  2012-09-01 15:57 ` Andreas Schwab
@ 2012-09-01 16:06   ` Ævar Arnfjörð Bjarmason
  2012-09-01 16:12     ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2012-09-01 16:06 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Git Mailing List

On Sat, Sep 1, 2012 at 5:57 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>>     git --no-pager show tag-name-1 | grep ^Author
>
> A tag doesn't have an author, it has a tagger.  This shows the author of
> the *commit*.

I got the grep wrong, I meant that I expected the tagger to be set
according to GIT_AUTHOR_{NAME,EMAIL}, but it isn't either:

    $ sh /tmp/test-tag.sh
    Initialized empty Git repository in /tmp/test-git/.git/
    [master (root-commit) f83fc11] README: testing content
     1 file changed, 1 insertion(+)
     create mode 100644 README
    Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    [master ef65731] README: testing content again
     1 file changed, 1 insertion(+), 1 deletion(-)
    Author: Test User <test@example.com>
    Tagger: Test User <test@example.com>
    Author: Test User <test@example.com>
    Tagger: Test User <test@example.com>
    Author: Test User <test@example.com>

>>     GIT_AUTHOR_NAME="Tag Test User"
>> GIT_AUTHOR_EMAIL="tagtest@example.com" git tag -a -m"another annotated
>> tag" tag-name-2
>
> The tagger is controlled by the committer info.

I don't get what you mean, what committer info?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?
  2012-09-01 16:06   ` Ævar Arnfjörð Bjarmason
@ 2012-09-01 16:12     ` Andreas Schwab
  2012-09-11 14:56       ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2012-09-01 16:12 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Git Mailing List

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> I don't get what you mean, what committer info?

GIT_COMMITTER_{NAME,EMAIL}.  A tagger isn't really an author.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?
  2012-09-01 16:12     ` Andreas Schwab
@ 2012-09-11 14:56       ` Ævar Arnfjörð Bjarmason
  2012-09-11 16:53         ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2012-09-11 14:56 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Git Mailing List, Junio C Hamano

On Sat, Sep 1, 2012 at 6:12 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> I don't get what you mean, what committer info?
>
> GIT_COMMITTER_{NAME,EMAIL}.  A tagger isn't really an author.

Ah, am I the only one that finds that a bit counterintuitive to the
point of wanting to submit a patch to change it?

If you've created a tag you're the *author* of that tag, the
author/committer distinction for commit objects is there for e.g.
rebases and applying commits via e.g. git-am.

We don't have a similar facility for tags (you have to push them
around directly), but we *could* and in that case having a
Tag-Committer as well well as a Tagger would make sense.

Junio, what do you think?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?
  2012-09-11 14:56       ` Ævar Arnfjörð Bjarmason
@ 2012-09-11 16:53         ` Junio C Hamano
  2012-09-11 16:58           ` demerphq
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2012-09-11 16:53 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Andreas Schwab, Git Mailing List

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> On Sat, Sep 1, 2012 at 6:12 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>>> I don't get what you mean, what committer info?
>>
>> GIT_COMMITTER_{NAME,EMAIL}.  A tagger isn't really an author.
>
> Ah, am I the only one that finds that a bit counterintuitive to the
> point of wanting to submit a patch to change it?
>
> If you've created a tag you're the *author* of that tag, the
> author/committer distinction for commit objects is there for e.g.
> rebases and applying commits via e.g. git-am.
>
> We don't have a similar facility for tags (you have to push them
> around directly), but we *could* and in that case having a
> Tag-Committer as well well as a Tagger would make sense.
>
> Junio, what do you think?

Unless your name is Linus Torvalds and it is early in year 2005, I
wouldn't even think about it.

When we introduced "tagger name can be overriden with environment",
we could have added GIT_TAGGER_{NAME,EMAIL}, but we didn't.  Given
that tagging happens far far less often than committing, I think it
was a sensible thing to do.

It is a perfectly normal thing in Git for you to commit a patch
authored by other people on behalf of them (and that is why AUTHOR
exists as a separate name from the committer), but you still stand
behind the commits you create by setting COMMITTER of them to you.
The fact that it was _you_ who create the tag has similar weight
that you have your name as the committer in commit objects, so in
that sense, I think the semantics used for the name in tag is far
closer to COMMITTER than AUTHOR.

I guess I wouldn't mind too much if "git tag" learned a "--tagger"
option, and honored GIT_TAGGER_{NAME,EMAIL} if set (and otherwise,
fall back to GIT_COMMITTER_{NAME,EMAIL}), but I do not know if it is
worth it.  How often would you want to _lie_ about your identity
when you are tagging, and what legitimate reason do you have for
doing so?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?
  2012-09-11 16:53         ` Junio C Hamano
@ 2012-09-11 16:58           ` demerphq
  0 siblings, 0 replies; 7+ messages in thread
From: demerphq @ 2012-09-11 16:58 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Ævar Arnfjörð, Andreas Schwab, Git Mailing List

On 11 September 2012 18:53, Junio C Hamano <gitster@pobox.com> wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> On Sat, Sep 1, 2012 at 6:12 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>>
>>>> I don't get what you mean, what committer info?
>>>
>>> GIT_COMMITTER_{NAME,EMAIL}.  A tagger isn't really an author.
>>
>> Ah, am I the only one that finds that a bit counterintuitive to the
>> point of wanting to submit a patch to change it?
>>
>> If you've created a tag you're the *author* of that tag, the
>> author/committer distinction for commit objects is there for e.g.
>> rebases and applying commits via e.g. git-am.
>>
>> We don't have a similar facility for tags (you have to push them
>> around directly), but we *could* and in that case having a
>> Tag-Committer as well well as a Tagger would make sense.
>>
>> Junio, what do you think?
>
> Unless your name is Linus Torvalds and it is early in year 2005, I
> wouldn't even think about it.
>
> When we introduced "tagger name can be overriden with environment",
> we could have added GIT_TAGGER_{NAME,EMAIL}, but we didn't.  Given
> that tagging happens far far less often than committing, I think it
> was a sensible thing to do.
>
> It is a perfectly normal thing in Git for you to commit a patch
> authored by other people on behalf of them (and that is why AUTHOR
> exists as a separate name from the committer), but you still stand
> behind the commits you create by setting COMMITTER of them to you.
> The fact that it was _you_ who create the tag has similar weight
> that you have your name as the committer in commit objects, so in
> that sense, I think the semantics used for the name in tag is far
> closer to COMMITTER than AUTHOR.
>
> I guess I wouldn't mind too much if "git tag" learned a "--tagger"
> option, and honored GIT_TAGGER_{NAME,EMAIL} if set (and otherwise,
> fall back to GIT_COMMITTER_{NAME,EMAIL}), but I do not know if it is
> worth it.  How often would you want to _lie_ about your identity
> when you are tagging, and what legitimate reason do you have for
> doing so?

Interestingly this came up because of the opposite problem. We wanted
to *prevent* users from telling lies about who they are.

IOW, when we do a rollout with git-deploy we want to automatically set
their username from a secondary authenticated source before we create
a rollout tag in their name.

cheers,
Yves




-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-09-11 16:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-01 15:34 Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email? Ævar Arnfjörð Bjarmason
2012-09-01 15:57 ` Andreas Schwab
2012-09-01 16:06   ` Ævar Arnfjörð Bjarmason
2012-09-01 16:12     ` Andreas Schwab
2012-09-11 14:56       ` Ævar Arnfjörð Bjarmason
2012-09-11 16:53         ` Junio C Hamano
2012-09-11 16:58           ` demerphq

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).