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

Re: [PATCH] Per-path attribute based hunk header selection.

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 6, 2007, 17:59 UTC
Message-ID
<alpine.LFD.0.98.0707061051020.9434@woody.linux-foundation.org>
In-Reply-To
<7v8x9uexji.fsf_-_@assigned-by-dhcp.cox.net>
On Fri, 6 Jul 2007, Junio C Hamano wrote:
>
> This makes"diff -p" hunk headers customizable via gitattributes mechanism.
> It is based on Johannes's earlier patch that allowed to define a single
> regexp to be used for everything.
Ok, I think this is really nice, but I do wonder a bit about the syntax.

In particular, the "funcname" thing is really a pretty ugly special-case approach.

Wouldn't it be nicer to consider the "funcname=java" to be less of a "special case for the built-in diff", and instead think of it as a more generic issue of "how do we want to generate diffs for java files?"

IOW, wouldn't this be much nicer to be thought about as a "custon diff driver" issue?

So I like your patches, but dislike the config syntax, and would suggest something like

In .gitattributes:
	*.java diff=java
	*.perl diff=perl
	*.doc diff=doc
In .git/config
	[diff "java"]
		command = internal
		funcname = ... # ugly and complicated regexp to override the built-in one.
	[diff "perl"]
		command = internal
		funcname = ...
	[diff "doc"]
		command = ms-doc-diff

Doesn't this make more sense and mesh much better with the already existing custom diff driver?

(And yeah, maybe we could instead of "command=internal" just have the rule that "internal" is the default, and you'd not have a command at all when you want to run the internal diff.

Just an idea. I don't have any code.
			Linus
Previous: Johannes SchindelinNext: Junio C Hamano
Message 16 of 29 in “diff: add custom regular expressions for function names”
  1. 2/2 diff: add custom regular expressions for function namesJohannes Schindelin, Jul 4, 2007
  2. Linus TorvaldsJul 4, 2007
  3. Johannes SchindelinJul 4, 2007
  4. Junio C HamanoJul 4, 2007
  5. Johannes SchindelinJul 4, 2007
  6. Junio C HamanoJul 5, 2007
  7. 1/2 Future-proof source for changes in xdemitconf_tJunio C Hamano, Jul 5, 2007
  8. Johannes SchindelinJul 5, 2007
  9. 2/2 WIP per-path attribute based hunk header selection.Junio C Hamano, Jul 5, 2007
  10. Johannes SchindelinJul 5, 2007
  11. Junio C HamanoJul 5, 2007
  12. 1/3 Introduce diff_filespec_is_binary()Junio C Hamano, Jul 6, 2007
  13. Johannes SchindelinJul 6, 2007
  14. Per-path attribute based hunk header selection.Junio C Hamano, Jul 6, 2007
  15. Johannes SchindelinJul 6, 2007
  16. Linus TorvaldsJul 6, 2007
  17. Junio C HamanoJul 7, 2007
  18. しらいしななこJul 7, 2007
  19. Junio C HamanoJul 7, 2007
  20. Johannes SchindelinJul 7, 2007
  21. Junio C HamanoJul 7, 2007
  22. Junio C HamanoJul 8, 2007
  23. Johannes SchindelinJul 8, 2007
  24. Nicolas PitreJul 9, 2007
  25. Junio C HamanoJul 9, 2007
  26. Johannes SchindelinJul 9, 2007
  27. Fix configuration syntax to specify customized hunk header patterns.Junio C Hamano, Jul 7, 2007
  28. Florian WeimerJul 5, 2007
  29. Johannes SchindelinJul 5, 2007

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.