Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?

Ævar Arnfjörð Bjarmason
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 "[hidden email]"

    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 "[hidden email]"
    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="[hidden email]" 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 <[hidden email]>
    [master 304b71e] README: testing content again
     1 file changed, 1 insertion(+), 1 deletion(-)
    Author: Test User <[hidden email]>
    Author: Test User <[hidden email]>
    Author: Test User <[hidden email]>

I'd expect references to "Tag Test User <[hidden email]>" for the
second tag I created.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?

Andreas Schwab-3
Ævar Arnfjörð Bjarmason <[hidden email]> 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="[hidden email]" git tag -a -m"another annotated
> tag" tag-name-2

The tagger is controlled by the committer info.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?

Ævar Arnfjörð Bjarmason
On Sat, Sep 1, 2012 at 5:57 PM, Andreas Schwab <[hidden email]> wrote:
> Ævar Arnfjörð Bjarmason <[hidden email]> 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 <[hidden email]>
    [master ef65731] README: testing content again
     1 file changed, 1 insertion(+), 1 deletion(-)
    Author: Test User <[hidden email]>
    Tagger: Test User <[hidden email]>
    Author: Test User <[hidden email]>
    Tagger: Test User <[hidden email]>
    Author: Test User <[hidden email]>

>>     GIT_AUTHOR_NAME="Tag Test User"
>> GIT_AUTHOR_EMAIL="[hidden email]" 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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?

Andreas Schwab-3
Ævar Arnfjörð Bjarmason <[hidden email]> 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, [hidden email]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?

Ævar Arnfjörð Bjarmason
On Sat, Sep 1, 2012 at 6:12 PM, Andreas Schwab <[hidden email]> wrote:
> Ævar Arnfjörð Bjarmason <[hidden email]> 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?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?

Junio C Hamano
Ævar Arnfjörð Bjarmason <[hidden email]> writes:

> On Sat, Sep 1, 2012 at 6:12 PM, Andreas Schwab <[hidden email]> wrote:
>> Ævar Arnfjörð Bjarmason <[hidden email]> 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?

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: Should GIT_AUTHOR_{NAME,EMAIL} set the tagger name/email?

demerphq
On 11 September 2012 18:53, Junio C Hamano <[hidden email]> wrote:

> Ævar Arnfjörð Bjarmason <[hidden email]> writes:
>
>> On Sat, Sep 1, 2012 at 6:12 PM, Andreas Schwab <[hidden email]> wrote:
>>> Ævar Arnfjörð Bjarmason <[hidden email]> 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/"
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html