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

Re: [PATCH v3 1/4] test-lib.sh: introduce and use $_EMPTY_TREE

From
Duy Nguyen <pclouds@gmail.com>
Date
Jul 13, 2016, 15:04 UTC
Message-ID
<CACsJy8B6faU6kaqSpNRZRxkrvM=W29acXkqVBdGq4gaqaDJRRA@mail.gmail.com>
In-Reply-To
<xmqq1t2y4mjy.fsf@gitster.mtv.corp.google.com>
On Tue, Jul 12, 2016 at 10:40 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 32 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> This is a special SHA1. Let's keep it at one place, easier to replace
>> later when the hash change comes, easier to recognize. Start with an
>> underscore to reduce the chances somebody may override it without
>> realizing it's predefined.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>>  t/t0000-basic.sh                |  2 +-
>>  t/t1100-commit-tree-options.sh  |  2 +-
>>  t/t4010-diff-pathspec.sh        |  6 ++----
>>  t/t4054-diff-bogus-tree.sh      | 10 ++++------
>>  t/t5504-fetch-receive-strict.sh |  4 ++--
>>  t/test-lib.sh                   |  4 +++-
>>  6 files changed, 13 insertions(+), 15 deletions(-)
>>
>> diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
>> index 60811a3..48214e9 100755
>> --- a/t/t0000-basic.sh
>> +++ b/t/t0000-basic.sh
>> @@ -834,7 +834,7 @@ test_expect_success 'git write-tree should be able to write an empty tree' '
>>  '
>>
>>  test_expect_success 'validate object ID of a known tree' '
>> -     test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904
>> +     test "$tree" = $_EMPTY_TREE
>>  '
>
> I doubt the point of, and I'd rather not to see, the leading
> underscore.  Are there existing uses of the name that want it to
> mean something different?

No. There is EMPTY_TREE in use, but it's exactly what we expect. It's probably still a good idea to separate "global" variables from per-file ones. But I don't feel strongly about this, so if a re-roll is required (or somebody votes for underscore removal, including you), I'll remove the underscore.

-- 
Duy
Previous: Junio C HamanoNext: Nguyễn Thái Ngọc Duy
Message 24 of 30 in “Git doesn't always add files to a commit (amend)”
  1. Yuri KanivetskyJul 4, 2016
  2. Duy NguyenJul 4, 2016
  3. cache-tree.c: fix i-t-a check skipping directory updates sometimesNguyễn Thái Ngọc Duy, Jul 4, 2016
  4. Junio C HamanoJul 6, 2016
  5. Junio C HamanoJul 6, 2016
  6. 0/2 cache-tree building fix in the presence of ita entriesNguyễn Thái Ngọc Duy, Jul 6, 2016
  7. 1/2 cache-tree.c: fix i-t-a entry skipping directory updates sometimesNguyễn Thái Ngọc Duy, Jul 6, 2016
  8. 2/2 cache-tree: do not generate empty trees as a result of all i-t-a subentriesNguyễn Thái Ngọc Duy, Jul 6, 2016
  9. Junio C HamanoJul 6, 2016
  10. Duy NguyenJul 7, 2016
  11. Junio C HamanoJul 7, 2016
  12. Duy NguyenJul 8, 2016
  13. Junio C HamanoJul 8, 2016
  14. Duy NguyenJul 8, 2016
  15. Junio C HamanoJul 8, 2016
  16. 0/4 cache-tree building fix in the presence of ita entriesNguyễn Thái Ngọc Duy, Jul 9, 2016
  17. 2/4 test-lib.sh: introduce and use $_EMPTY_BLOBNguyễn Thái Ngọc Duy, Jul 9, 2016
  18. 3/4 cache-tree.c: fix i-t-a entry skipping directory updates sometimesNguyễn Thái Ngọc Duy, Jul 9, 2016
  19. 4/4 cache-tree: do not generate empty trees as a result of all i-t-a subentriesNguyễn Thái Ngọc Duy, Jul 9, 2016
  20. Junio C HamanoJul 12, 2016
  21. Duy NguyenJul 13, 2016
  22. 1/4 test-lib.sh: introduce and use $_EMPTY_TREENguyễn Thái Ngọc Duy, Jul 9, 2016
  23. Junio C HamanoJul 12, 2016
  24. Duy NguyenJul 13, 2016
  25. 0/4 cache-tree building fix in the presence of ita entriesNguyễn Thái Ngọc Duy, Jul 16, 2016
  26. 1/4 test-lib.sh: introduce and use $EMPTY_TREENguyễn Thái Ngọc Duy, Jul 16, 2016
  27. 3/4 cache-tree.c: fix i-t-a entry skipping directory updates sometimesNguyễn Thái Ngọc Duy, Jul 16, 2016
  28. 4/4 cache-tree: do not generate empty trees as a result of all i-t-a subentriesNguyễn Thái Ngọc Duy, Jul 16, 2016
  29. 2/4 test-lib.sh: introduce and use $EMPTY_BLOBNguyễn Thái Ngọc Duy, Jul 16, 2016
  30. Junio C HamanoJul 18, 2016

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.