Hi,
Ævar Arnfjörð Bjarmason wrote:
> On Wed, Aug 29 2018, Jonathan Nieder wrote:
>> what objects would you expect the following to refer to?
>>
>> abcdabcd^{sha1}
>> abcdabcd^{sha256}
>> ef01ef01^{sha1}
>> ef01ef01^{sha256}
>
> I still can't really make any sense of why anyone would even want #2 as
> described above, but for this third case I think we should do this:
>
> abcdabcd^{sha1} = abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd
> abcdabcd^{sha256} =
> ef01ef01ef01ef01ef01ef01ef01ef01ef01ef01ef01ef01ef01ef01ef01ef01
> ef01ef01^{sha1} = ef01ef01ef01ef01ef01ef01ef01ef01ef01ef01
> ef01ef01^{sha256} = abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd...
>
> I.e. a really useful thing about this peel syntax is that it's
> forgiving, and will try to optimistically look up what you want.
Sorry, I'm still not understanding.
I am not attached to any particular syntax, but what I really want is
the following:
Someone who only uses SHA-256 sent me the commit id
abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd... out of band.
Show me that commit.
I don't care what object id you show me when you show that
commit. If I pass --output-format=sha1, then that means I
care, and show me the SHA-1.
In other words, I want the input format and output format completely
decoupled. If I pass ^{sha1}, I am indicating the input format. To
specify the output format, I'd use --output-format instead.
That lets me mix both hash functions in my input:
git --output-format=sha256 diff abcdabcd^{sha1} abcdabcd^{sha256}
I learned about these two commits out of band from different users,
one who only uses SHA-1 and the other who only uses SHA-256.
In other words:
[...]
> Similarly, I think it would be very useful if we just make this work:
>
> git rev-parse $some_hash^{sha256}^{commit}
>
> And not care whether $some_hash is SHA-1 or SHA-256, if it's the former
> we'd consult the SHA-1 <-> SHA-256 lookup table and go from there, and
> always return a useful value.
The opposite of this. :)
Thanks,
Jonathan