From: Jonathan Nieder <jrnieder@gmail.com>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org, Jens Lehmann <jens.lehmann@web.de>,
Jeff King <peff@peff.net>
Subject: Re: Re: [PATCH] implement submodule config cache for lookup of submodule names
Date: Wed, 12 Mar 2014 17:46:05 -0700 [thread overview]
Message-ID: <20140313004605.GC15625@google.com> (raw)
In-Reply-To: <20140312235833.GA5300@sandbox-ub>
Heiko Voigt wrote:
> On Tue, Mar 11, 2014 at 07:28:52PM -0700, Jonathan Nieder wrote:
>> Heiko Voigt wrote:
>>> +static unsigned int hash_sha1_string(const unsigned char *sha1, const char *string)
>>> +{
>>> + return memhash(sha1, 20) + strhash(string);
>>> +}
>>
>> Feels a bit unconventional. I can't find a strong reason to mind.
>
> Well I did not think much about this. I simply thought: hash -> kind of
> random value. Adding the two together is as good as anything (even
> overflow does not matter).
[...]
> I am fine with a switch to something different. We could use classic XOR
> in case that feels better.
Either + or ^ is fine with me (yeah, '^' is what I expected so '+'
forced me to think for a few seconds). I don't think we have to worry
much about hostile people making repos that force git to spend a long
time dealing with hash collisions, so anything more complicated is
probably overkill. :)
[...]
>> [...]
>>> +static void warn_multiple_config(struct submodule_config *config, const char *option)
>>> +{
>>> + warning("%s:.gitmodules, multiple configurations found for submodule.%s.%s. "
>>> + "Skipping second one!", sha1_to_hex(config->gitmodule_sha1),
>>> + option, config->name.buf);
>>
>> Ah, so gitmodule_sha1 is a commit id?
>
> No, this output is a bug. gitmodule_sha1 is actually the sha1 of the
> .gitmodule blob we read. Thanks for noticing will fix. Should I also add
> a comment to the gitmodule_sha1 field to explain what it is?
[...]
> with
> the clarification does the name make sense now?
Yep. Suggested fixes:
- call it gitmodules_sha1 instead of gitmodule_sha1 (it's the blob
name for .gitmodules, not the name of a module)
- add a comment where the field is declared (this would make it clear
that it's a blob name instead of e.g. just the SHA-1 of the text)
Thanks for your thoughtfulness.
Jonathan
prev parent reply other threads:[~2014-03-13 0:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 21:24 [PATCH] implement submodule config cache for lookup of submodule names Heiko Voigt
2014-03-11 21:58 ` Jeff King
2014-03-12 17:07 ` Heiko Voigt
2014-03-12 2:28 ` Jonathan Nieder
2014-03-12 23:58 ` Heiko Voigt
2014-03-13 0:46 ` Jonathan Nieder [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140313004605.GC15625@google.com \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=jens.lehmann@web.de \
--cc=peff@peff.net \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).