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

Re: [PATCHv2 1/2] attr: map builtin userdiff drivers to well-known extensions

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 19, 2011, 18:07 UTC
Message-ID
<20111219180733.GA12200@elie.hsd1.il.comcast.net>
In-Reply-To
<20111219154938.GA19829@sigill.intra.peff.net>
Hi,
Two quick thoughts:
Jeff King wrote:
> The C mappings are still here, but see the next patch.

This is adding a regression in order to remove it. I guess it's harmless, but I don't see the point.

[...]
Show 17 quoted lines
> --- a/t/t4012-diff-binary.sh
> +++ b/t/t4012-diff-binary.sh
> @@ -90,4 +90,17 @@ test_expect_success 'diff --no-index with binary creation' '
>  	test_cmp expected actual
>  '
>  
> +test_expect_success 'binary files are not considered text by file extension' '
> +	echo Q | q_to_nul >binary.c &&
> +	git add binary.c &&
> +	cat >expect <<-\EOF &&
> +	diff --git a/binary.c b/binary.c
> +	new file mode 100644
> +	index 0000000..1f2a4f5
> +	Binary files /dev/null and b/binary.c differ
> +	EOF
> +	git diff --cached binary.c >actual &&
> +	test_cmp expect actual
Re the idea of this test: very good idea.
Re the mechanics: I would have been happier to see
	echo Q | q_to_nul >binary.c &&
	git add binary.c &&
	git diff --cached binary.c >diff &&
	grep Binary files diff
since that would avoid hard-coding some assumptions:
 - the blob name of binary.c
 - that [diff] mnemonicprefix defaults to false (I'd like to see the
   default change to true)
 - that [core] abbrev defaults to 7 (it probably won't change, but
   it's a distracting detail, and if we were starting over 8 might be
   a better default)
A bonus comment: :)
[...]
Show 12 quoted lines
> --- a/t/t4018-diff-funcname.sh
> +++ b/t/t4018-diff-funcname.sh
> @@ -124,7 +124,9 @@ do
>  done
>  
>  test_expect_success 'default behaviour' '
> -	rm -f .gitattributes &&
> +	cat >.gitattributes <<-\EOF &&
> +	*.java diff=default
> +	EOF
>  	test_expect_funcname "public class Beer\$"
>  '
	echo "*.java diff=default" >.gitattributes
would do the same with two lines fewer. :)
Thanks for working on this.  I owe you a beer.
Jonathan
Previous: Jeff KingNext: Jeff King
Message 12 of 35 in “attr: map builtin userdiff drivers to well-known extensions”
  1. attr: map builtin userdiff drivers to well-known extensionsJeff King, Dec 16, 2011
  2. Johannes SixtDec 16, 2011
  3. Junio C HamanoDec 16, 2011
  4. Jeff KingDec 16, 2011
  5. Jeff KingDec 16, 2011
  6. Junio C HamanoDec 16, 2011
  7. Jeff KingDec 17, 2011
  8. Johannes SixtDec 16, 2011
  9. Jeff KingDec 17, 2011
  10. Jonathan NiederDec 17, 2011
  11. 1/2 attr: map builtin userdiff drivers to well-known extensionsJeff King, Dec 19, 2011
  12. Jonathan NiederDec 19, 2011
  13. Jeff KingDec 19, 2011
  14. Ævar Arnfjörð BjarmasonDec 22, 2011
  15. 2/2 attr: drop C/C++ default extension mappingJeff King, Dec 19, 2011
  16. Jonathan NiederDec 19, 2011
  17. Thomas RastDec 19, 2011
  18. t4018: introduce test cases for the internal hunk header patternsBrandon Casey, Dec 19, 2011
  19. t4018: add a few more test cases for cpp hunk header matchingBrandon Casey, Dec 19, 2011
  20. Junio C HamanoDec 19, 2011
  21. Brandon CaseyDec 19, 2011
  22. Junio C HamanoDec 19, 2011
  23. t4018: introduce test cases for the internal hunk header patternsBrandon Casey, Dec 20, 2011
  24. Jakub NarebskiDec 20, 2011
  25. Brandon CaseyDec 20, 2011
  26. Thomas RastDec 20, 2011
  27. Johannes SixtDec 20, 2011
  28. Junio C HamanoDec 20, 2011
  29. Mark LevedahlDec 16, 2011
  30. Jeff KingDec 16, 2011
  31. Philip OakleyDec 16, 2011
  32. Jeff KingDec 16, 2011
  33. Philip OakleyDec 21, 2011
  34. Jeff KingDec 23, 2011
  35. Junio C HamanoDec 16, 2011

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.