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

[PATCHv2 2/2] attr: drop C/C++ default extension mapping

From
Jeff King <peff@peff.net>
Date
Dec 19, 2011, 15:57 UTC
Message-ID
<20111219155737.GB19829@sigill.intra.peff.net>
In-Reply-To
<20111217033808.GA8683@elie.hsd1.il.comcast.net>

The point of this mapping is largely to get funcname support. However, there's been some indication that our C funcname pattern produces worse results than the default pattern, so let's leave it unmapped for now.

If and when it improves, this commit can be reverted.
Signed-off-by: Jeff King <peff@peff.net>
---
Obviously this could just be squashed into the first patch. But I think
I'd rather leave a more explicit note in the history.

When writing the justification for this commit message, though, I did notice that my reasoning is slightly flawed. The complaint is that the C funcname pattern sucks, and therefore a user who hasn't configured anything has a worse experience with patch 1. But enabling that sucky experience is a two-step process:

  1. map *.c, etc to the diff driver "cpp"
  2. diff driver "cpp" has a funcname (which is reportedly bad)

Since this series is about tweaking extension mapping, the natural thing to do is not enable (1).

But when you think about it, if our funcname pattern is bad, shouldn't preventing (2) be the right thing? That is, if our funcname pattern is really worse than the default language-agnostic match, wouldn't we be doing everybody a service to simply remove the builtin diff.cpp.xfuncname pattern?

Then you're not only not causing a regression for users who haven't configured anything; you're actively helping people who have set "diff=cpp" themselves.

Of course you're causing a regression to people who _like_ the current diff.cpp.xfuncname. But if they are so widespread, then why is there so much opposition to turning it on by default? My theory is that people aren't actually using the builtin diff.cpp.xfuncname.

 attr.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/attr.c b/attr.c
index 10713f3..2f33128 100644
--- a/attr.c
+++ b/attr.c
@@ -316,12 +316,6 @@ static void free_attr_elem(struct attr_stack *e)
 	"*.rb diff=ruby",
 	"*.bib diff=bibtex",
 	"*.tex diff=tex",
-	"*.c diff=cpp",
-	"*.cc diff=cpp",
-	"*.cxx diff=cpp",
-	"*.cpp diff=cpp",
-	"*.h diff=cpp",
-	"*.hpp diff=cpp",
 	"*.cs diff=csharp",
 	"*.[Ff] diff=fortran",
 	"*.[Ff][0-9][0-9] diff=fortran",
-- 
1.7.8.rc2.38.gd9625
Previous: Ævar Arnfjörð BjarmasonNext: Jonathan Nieder
Message 15 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.