From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Duy Nguyen <pclouds@gmail.com>,
Nasser Grainawi <nasser@codeaurora.org>,
Martin Fick <mfick@codeaurora.org>,
james.moger@gitblit.com, Thomas Koch <thomas@koch.ro>,
Jeremy Rosen <jeremy.rosen@openwide.fr>,
Git Mailing List <git@vger.kernel.org>,
Shawn Pearce <spearce@spearce.org>
Subject: Re: RFE: support change-id generation natively
Date: Thu, 24 Oct 2013 13:04:29 -0700 [thread overview]
Message-ID: <xmqqzjpymo4y.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <5268B7D6.5050106@viscovery.net> (Johannes Sixt's message of "Thu, 24 Oct 2013 08:01:58 +0200")
Johannes Sixt <j.sixt@viscovery.net> writes:
> Am 10/24/2013 7:25, schrieb Duy Nguyen:
>> On Thu, Oct 24, 2013 at 11:11 AM, Nasser Grainawi <nasser@codeaurora.org> wrote:
>>>>> It is not clear to me how you envision to make it work.
>>>>
>>>> I don't have the source code.
>>>
>>> Now you do: https://gerrit.googlesource.com/gerrit/+/master/gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg
>>
>> Thanks. So you do have tree sha-1 by running "git write-tree". But at
>> that point I'm not sure if cache-tree is written down to disk yet, so
>> write-tree could be more expensive than necessary (one good point for
>> building --change-id in).
>
> Consider that I make a commit with a change-id. Then I rewrite the commit,
> but keep the change-id. Then I push the rewritten commit to Gerrit. Gerrit
> does not have the objects that the change-id is based on; the change-id is
> just a random number and has no other significance. Right?
>
> Why do you go all the length in computing a change-id instead of just
> pulling 20 bytes from /dev/random?
Very good point.
The quoted script does not necessarily give the right commit object
name at least under three scenarios:
- when we would need to add encoding header, etc.;
- when we are recording merges (perhaps merges will not get rebased
in Gerrit workflow and it does not matter what random garbage
this script added to them).
- when we record the commit after 1-sec boundary since _gen_ChangeIdInput
in the script was called.
I wouldn't call the script "buggy", but I tend to agree with you
that it is an unnecessarily more complex way to spell "grab 20
random bytes" ;-)
> That said, I don't think that --change-id option that the user must not
> forget to use is any better than a hook that the user must not forget to
> install.
That is why I said this in my first response to this thread:
>> ... We may even want to
>> introduce commit.changeId boolean configuration variable if we did
>> so.
next prev parent reply other threads:[~2013-10-24 20:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 14:48 RFE: support change-id generation natively james.moger
2013-10-21 14:51 ` Jeremy Rosen
2013-10-21 15:41 ` james.moger
2013-10-21 16:35 ` Shawn Pearce
2013-10-21 16:38 ` Ondřej Bílka
2013-10-21 23:07 ` Shawn Pearce
2013-10-21 18:29 ` Thomas Koch
2013-10-21 18:40 ` james.moger
2013-10-21 18:49 ` Martin Fick
2013-10-22 19:50 ` Junio C Hamano
2013-10-22 20:06 ` Pyeron, Jason J CTR (US)
2013-10-22 20:43 ` Junio C Hamano
2013-10-23 6:36 ` Duy Nguyen
2013-10-23 16:00 ` Junio C Hamano
2013-10-24 2:07 ` Duy Nguyen
2013-10-24 4:11 ` Nasser Grainawi
2013-10-24 5:25 ` Duy Nguyen
2013-10-24 6:01 ` Johannes Sixt
2013-10-24 12:11 ` james.moger
2013-10-24 12:51 ` Thomas Koch
2013-10-24 13:31 ` Duy Nguyen
2013-10-24 20:04 ` Junio C Hamano [this message]
2013-10-25 6:37 ` Johannes Sixt
2013-10-21 23:10 ` Shawn Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqzjpymo4y.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=james.moger@gitblit.com \
--cc=jeremy.rosen@openwide.fr \
--cc=mfick@codeaurora.org \
--cc=nasser@codeaurora.org \
--cc=pclouds@gmail.com \
--cc=spearce@spearce.org \
--cc=thomas@koch.ro \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.