Re: [PATCH] cache-tree: do not cache empty trees

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/2/5 Jonathan Nieder <jrnieder@xxxxxxxxx>:
> Nguyán ThÃi Ngác Duy wrote:
>> +
>> +T1=f4ec99e8174c01eab488469b4c2680500bbb18da
>> +T2=4b825dc642cb6eb9a060e54bf8d69288fbee4904
>
> What are these trees? ÂDo they need to be hardcoded?

I have uneasy feeling constructing a tree manually. Hardcoding it (or
less automatic check) makes me feel better. I'm cooking a patch to
make hash-object reject malformed trees/commits/tags. Then I'll remove
these SHA-1.

>> +
>> +test_expect_success 'setup' '
>> + Â Â printf "40000 empty\0\x4b\x82\x5d\xc6\x42\xcb\x6e\xb9\xa0\x60\xe5\x4b\xf8\xd6\x92\x88\xfb\xee\x49\x04" >newtree &&
>
> printf '\xab' is unfortunately unportable. ÂI suppose
> this should rather say something like
>
> Âtest_unequal () {
> Â Â Â Âprintf '%s\n' "$1" >bad &&
> Â Â Â Âprintf '%s\n' "$2" >actual &&
> Â Â Â Â! test_cmp bad actual
> Â}
>
> Â Â Â Âempty_tree=$(git mktree </dev/null) &&
> Â Â Â Âtree_with_empty_subtree=$(
>        Âecho "040000 tree $empty_tree  empty" |
> Â Â Â Â Â Â Â Âgit mktree
> Â Â Â Â) &&
> Â Â Â Âtest_unequal "$empty_tree" "$tree_with_empty_subtree"

Hah! Was wondering how the heck they could create trees manually. So
it's mktree. Thanks!

> Â Â Â Â...
>
> Sane?

Don't know. But it's definitely saner than my version.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]