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

Re: [RFC PATCH] checkout: Force matching mtime between files

From
Duy Nguyen <pclouds@gmail.com>
Date
Apr 30, 2018, 15:10 UTC
Message-ID
<CACsJy8AcB5+n-3xdipT8Dve5V68vVRf9sAEOGPTSCe9xKjYHyw@mail.gmail.com>
In-Reply-To
<xmqqpo2hzhwg.fsf@gitster-ct.c.googlers.com>
On Mon, Apr 30, 2018 at 1:56 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
> Duy Nguyen <pclouds@gmail.com> writes:
>
>> Target revision should be available in the index. But this gives me an
>> idea to another thing that bugs me: sending the list to the hook means
>> I have to deal with separator (\n or NUL?) or escaping. This mentions
>> of index makes me take a different direction. I could produce a small
>> index that contains just what is modified, then you can retrieve
>> whatever info you want with `git ls-files` or even `git show` after
>> pointing $GIT_INDEX_FILE to it.
>
> That's somewhere in between a tail wagging the dog and a hammer
> looking like a solution even when you have a screw.  By passing a
> temporary index, you may be able to claim that you are feeding the
> necessary information without corruption and in a readable and
> native format of Git, and make it up to the reader to grab the paths
> out of it, but
>
>  (1) the contents, and probably the cached stat information, in that
>      temporary index is duplicated and wasted; you know from the
>      time you design this thing that all you want to convey is a
>      list of paths.

Yep, I was not happy about this. Which I why I moved to update the hook calling convention to pass pathspec to the hook instead.

>  (2) it is totally unclear who is responsible for cleaning the
>      temporary file up.
The one that creates it deletes it, which is git.
Show 6 quoted lines
>  (3) the recipient must walk and carefully grab the path, certainly
>      has to "deal with separator (\n or NUL?) or escaping" anyway,
>      especially if the reason you use a temporary index is because
>      "they can use ls-files on it".  They need to read from ls-files
>      anyway, so that is no better than feeding ls-files compatible
>      input from the standard input of the hook script.

Err "ls-files compatible input" or "ls-files compatible _output_"? If by input you mean the pathspec we give to ls-files, I agree. If it's standard ls-files --stage output , letting the hook call ls-files lets it select the output format it wants (including the potential json output in the future), which is more flexible.

>
> no?
-- 
Duy
Previous: Junio C HamanoNext: Duy Nguyen
Message 17 of 35 in “checkout: Force matching mtime between files”
  1. checkout: Force matching mtime between filesMichał Górny, Apr 13, 2018
  2. Robin H. JohnsonApr 23, 2018
  3. Junio C HamanoApr 23, 2018
  4. Robin H. JohnsonApr 25, 2018
  5. Junio C HamanoApr 25, 2018
  6. Marc BranchaudApr 25, 2018
  7. Robin H. JohnsonApr 25, 2018
  8. Junio C HamanoApr 26, 2018
  9. Marc BranchaudApr 26, 2018
  10. Michał GórnyApr 26, 2018
  11. Duy NguyenApr 28, 2018
  12. Michał GórnyApr 28, 2018
  13. Duy NguyenApr 26, 2018
  14. Robin H. JohnsonApr 26, 2018
  15. Duy NguyenApr 26, 2018
  16. Junio C HamanoApr 29, 2018
  17. Duy NguyenApr 30, 2018
  18. Duy NguyenApr 27, 2018
  19. Elijah NewrenApr 27, 2018
  20. Duy NguyenApr 28, 2018
  21. Junio C HamanoApr 29, 2018
  22. Marc BranchaudApr 27, 2018
  23. Duy NguyenApr 28, 2018
  24. Michał GórnyApr 27, 2018
  25. Ævar Arnfjörð BjarmasonApr 27, 2018
  26. Ævar Arnfjörð BjarmasonApr 25, 2018
  27. Duy NguyenApr 26, 2018
  28. Robin H. JohnsonApr 26, 2018
  29. SZEDER GáborApr 26, 2018
  30. Duy NguyenApr 26, 2018
  31. Marc BranchaudApr 24, 2018
  32. Robin H. JohnsonApr 25, 2018
  33. Michał GórnyApr 25, 2018
  34. Jeff KingMay 5, 2018
  35. Junio C HamanoMay 6, 2018

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.