git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Feb 5, 2011, 10:32 UTC
Message-ID
<AANLkTingZB_+3W-PBATCVywjR31ft_AH+e0Z+4rsUR45@mail.gmail.com>
In-Reply-To
<20110205101412.GB1685@elie>
2011/2/5 Jonathan Nieder <jrnieder@gmail.com>:
Show 6 quoted lines
> 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.

Show 19 quoted lines
>> +
>> +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
Previous: Jonathan NiederNext: Nguyễn Thái Ngọc Duy
Message 4 of 20 in “cache-tree: do not cache empty trees”
  1. cache-tree: do not cache empty treesNguyễn Thái Ngọc Duy, Feb 5, 2011
  2. cache-tree: do not cache empty treesNguyễn Thái Ngọc Duy, Feb 5, 2011
  3. Jonathan NiederFeb 5, 2011
  4. Nguyen Thai Ngoc DuyFeb 5, 2011
  5. cache-tree: do not cache empty treesNguyễn Thái Ngọc Duy, Feb 5, 2011
  6. Junio C HamanoFeb 7, 2011
  7. Nguyen Thai Ngoc DuyFeb 7, 2011
  8. correct type of EMPTY_TREE_SHA1_BINJonathan Nieder, Feb 7, 2011
  9. Junio C HamanoFeb 9, 2011
  10. Jonathan NiederFeb 7, 2011
  11. Nguyen Thai Ngoc DuyFeb 7, 2011
  12. Ilari LiusvaaraFeb 7, 2011
  13. Nguyen Thai Ngoc DuyFeb 7, 2011
  14. Jonathan NiederFeb 7, 2011
  15. Junio C HamanoFeb 7, 2011
  16. Nguyen Thai Ngoc DuyFeb 8, 2011
  17. Jonathan NiederFeb 8, 2011
  18. Yann DirsonFeb 15, 2011
  19. Jakub NarebskiFeb 16, 2011
  20. Ilari LiusvaaraFeb 8, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.