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

Re: [PATCH] diff: add support for reading files literally with --no-index

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 4, 2019, 19:26 UTC
Message-ID
<xmqq36q8cjgf.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190104025724.GG423984@genre.crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 7 quoted lines
>>  - --dereference to control whether to follow symlinks
>
> This is actually surprisingly difficult. The reason I implemented this
> only for no-index mode is because there are actually several places we
> can stat a file in the diff code, and implementing a --dereference
> option that catches all of those cases and getting the option passed
> down to them is non-trivial.

Another thing to worry about is symlinks that point outside the working tree. When a tracked content "dir/link" is a symlink to "/etc/motd", it probably makes sense to open("/etc/motd") and read() it on the working tree side of the diff, and probably even on the index side of the diff, but what about obtaining contents for "dir/link" in a year-old commit under --deference mode? I am not sure if it makes sense to read from the filesystem in such a case.

I personally am perfectly fine if this "do not compare readlink(2), but read contents literally" is limited to the --no-index mode.

Thanks.
Previous: brian m. carlsonNext: brian m. carlson
Message 17 of 18 in “diff: add support for reading files literally with --no-index”
  1. diff: add support for reading files literally with --no-indexbrian m. carlson, Dec 20, 2018
  2. Jeff KingDec 20, 2018
  3. brian m. carlsonDec 21, 2018
  4. Duy NguyenDec 20, 2018
  5. Jeff KingDec 20, 2018
  6. Duy NguyenDec 20, 2018
  7. Jeff KingDec 20, 2018
  8. Duy NguyenDec 20, 2018
  9. Ævar Arnfjörð BjarmasonDec 20, 2018
  10. brian m. carlsonDec 20, 2018
  11. Johannes SchindelinDec 21, 2018
  12. brian m. carlsonDec 21, 2018
  13. Junio C HamanoJan 2, 2019
  14. brian m. carlsonJan 4, 2019
  15. Jonathan NiederJan 4, 2019
  16. brian m. carlsonJan 4, 2019
  17. Junio C HamanoJan 4, 2019
  18. brian m. carlsonJan 5, 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.