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

Re: git diff bug?

From
Jeff King <peff@peff.net>
Date
Apr 6, 2009, 15:53 UTC
Message-ID
<20090406155303.GA3275@sigill.intra.peff.net>
In-Reply-To
<1BF9172A-BE91-4D1C-932A-EB9FD79BA402@boostpro.com>
On Mon, Apr 06, 2009 at 05:09:32AM -0400, David Abrahams wrote:
Show 7 quoted lines
> Hmm, so I tried sticking this .gitattributes in my repo
>
>   *.el   diff=el
>   [diff "el"]
>         xfuncname = "^(\\(def[a-z]+ .+)$"
>
> and git diff barfed with

As Michael explained, the first line goes into .gitattributes, and the second two go into your .git/config.

The reason is that the first line is describing a property of files in the repo: "*.el is of type 'el' for diffing". And thus it makes sense for it to be committed along with the content in the repo.

But the latter two lines are about preference: "here is how _I_ would like to generate diffs for el files". So they go in your personal config which is not shipped with the repo. And most likely you would want to put them not in per-repo config, but in your user config: $HOME/.gitconfig.

All of that being said, it is obviously a documentation failure if it didn't explain in which files the various parts go. If you don't mind, can you skim over the documentation you read one more time and point out where it led you wrong? Maybe we can make it a little clearer.

-Peff
Previous: Jeff KingNext: Matthieu Moy
Message 8 of 13 in “git diff bug?”
  1. David AbrahamsApr 4, 2009
  2. Jeff KingApr 4, 2009
  3. Jeff KingApr 4, 2009
  4. David AbrahamsApr 6, 2009
  5. Michael J GruberApr 6, 2009
  6. David AbrahamsApr 6, 2009
  7. Jeff KingApr 6, 2009
  8. Jeff KingApr 6, 2009
  9. Matthieu MoyApr 6, 2009
  10. Junio C HamanoApr 6, 2009
  11. Matthieu MoyApr 6, 2009
  12. David AbrahamsApr 6, 2009
  13. Antriksh PanyApr 7, 2009

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.