From: Nguyen Thai Ngoc Duy Date: Sat, 05 Feb 2011 10:32:05 GMT Subject: Re: [PATCH] cache-tree: do not cache empty trees Message-ID: In-Reply-To: <20110205101412.GB1685@elie> 2011/2/5 Jonathan Nieder : > 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        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