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

Re: [PATCH 07/15] t4011: abstract away SHA-1-specific constants

From
Derrick Stolee <stolee@gmail.com>
Date
Oct 8, 2019, 12:38 UTC
Message-ID
<db17a07f-1edc-f55a-8dc6-ab41287afcc6@gmail.com>
In-Reply-To
<CAKPyHN3NaBv5s9aefb8fTDeGto2tLyTa0DxTjbWO9pGRY22pPQ@mail.gmail.com>
On 10/8/2019 8:33 AM, Bert Wesarg wrote:
Show 24 quoted lines
> On Tue, Oct 8, 2019 at 2:21 PM Derrick Stolee <stolee@gmail.com> wrote:
>>
>> On 10/5/2019 5:12 PM, brian m. carlson wrote:
>>> Adjust the test so that it computes variables for object IDs instead of
>>> using hard-coded hashes.
>>
>> [snip]
>>
>>> @@ -137,14 +141,17 @@ test_expect_success SYMLINKS 'setup symlinks with attributes' '
>>>  '
>>>
>>>  test_expect_success SYMLINKS 'symlinks do not respect userdiff config by path' '
>>> -     cat >expect <<-\EOF &&
>>> +     file=$(git rev-parse --short $(git hash-object file.bin)) &&
>>> +     link=$(git rev-parse --short \
>>> +             $(printf file.bin | git hash-object --stdin)) &&
>>
>> Why this change from $(git hash-object file.bin) to
>> $(printf file.bin | git hash-object --stdin)?
> 
> thats two different things. The first hashes the content of file
> "file.bin". The second hashes the literal string "file.bin". To avoid
> this confusion, may I suggest to use 'printf "%s" "file.bin"', so that
> it is clear, that the literal string is meant in this context?

Ah, and because the resulting hash is for the contents of the symlink (not the contents of the file), it makes sense to use printf here.

Thanks for the clarification!
-Stolee
Previous: Bert WesargNext: brian m. carlson
Message 9 of 24 in “SHA-256 test fixes, part 6”
  1. 00/15 SHA-256 test fixes, part 6brian m. carlson, Oct 5, 2019
  2. 01/15 t/oid-info: allow looking up hash algorithm namebrian m. carlson, Oct 5, 2019
  3. 04/15 t1305: avoid comparing extensionsbrian m. carlson, Oct 5, 2019
  4. 02/15 t/oid-info: add empty tree and empty blob valuesbrian m. carlson, Oct 5, 2019
  5. 05/15 t3429: remove SHA1 annotationbrian m. carlson, Oct 5, 2019
  6. 07/15 t4011: abstract away SHA-1-specific constantsbrian m. carlson, Oct 5, 2019
  7. Derrick StoleeOct 8, 2019
  8. Bert WesargOct 8, 2019
  9. Derrick StoleeOct 8, 2019
  10. brian m. carlsonOct 8, 2019
  11. 03/15 rev-parse: add an --object-format optionbrian m. carlson, Oct 5, 2019
  12. Derrick StoleeOct 8, 2019
  13. brian m. carlsonOct 8, 2019
  14. 08/15 t4015: abstract away SHA-1-specific constantsbrian m. carlson, Oct 5, 2019
  15. Derrick StoleeOct 8, 2019
  16. 06/15 t4010: abstract away SHA-1-specific constantsbrian m. carlson, Oct 5, 2019
  17. 11/15 t4038: abstract away SHA-1 specific constantsbrian m. carlson, Oct 5, 2019
  18. 12/15 t4039: abstract away SHA-1-specific constantsbrian m. carlson, Oct 5, 2019
  19. 09/15 t4027: make hash-size independentbrian m. carlson, Oct 5, 2019
  20. 13/15 t4044: update test to work with SHA-256brian m. carlson, Oct 5, 2019
  21. 15/15 t4048: abstract away SHA-1-specific constantsbrian m. carlson, Oct 5, 2019
  22. 14/15 t4045: make hash-size independentbrian m. carlson, Oct 5, 2019
  23. 10/15 t4034: abstract away SHA-1-specific constantsbrian m. carlson, Oct 5, 2019
  24. Derrick StoleeOct 8, 2019

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.