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 2, 2019, 18:56 UTC
Message-ID
<xmqqr2dukhw2.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181220002610.43832-1-sandals@crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
Show 18 quoted lines
> +test_expect_success SYMLINKS 'diff --no-index --literally with symlinks' '
> +	test_write_lines a b c >f1 &&
> +	test_write_lines a d c >f2 &&
> +	ln -s f1 s1 &&
> +	ln -s f2 s2 &&
> +	cat >expect <<-\EOF &&
> +	diff --git a/s1 b/s2
> +	--- a/s1
> +	+++ b/s2
> +	@@ -1,3 +1,3 @@
> +	 a
> +	-b
> +	+d
> +	 c
> +	EOF
> +	test_expect_code 1 git diff --no-index --literally s1 s2 >actual &&
> +	test_cmp expect actual
> +'

This is good as a goal, but the implementation seems to be overly eager to dereference any symlink or non-regular file found in any level of recursion. The use case presented as the justification in the proposed log message, and the explanation in the documentation, suggests that only the paths given from the command line are treated this way.

It may make sense to do this as two orthgonal flags. Dereference symlinks and named pipes given from the command line is one use case. Dereference any symlinks encountered during recursion is another. And the latter might be useful even inside a repository as an option, even though the former would never make sense unless running in --no-index mode.

Thanks.
Previous: brian m. carlsonNext: brian m. carlson
Message 13 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.