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

Re: [PATCH 3/2] attribute "coding": specify blob encoding

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 4, 2008, 20:53 UTC
Message-ID
<7vwsqpia7m.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080105.011649.26949633.tshibata@ab.jp.nec.com>
Tsugikazu Shibata <tshibata@ab.jp.nec.com> writes:
> So, question is why we should think of this field in case of non
> programming language files ? 
> In case of text file using any coding, Should we need to add something
> after "@@"?

See gitattributes(5), "Defining a custom hunk-header". The associated configuration variable for this feature is somewhat misnamed [*1*], but if you do not want to see anything, I think you should be able to define a custom pattern that match emptyness.

For .txt files, I always hoped that someday, somebody clever would come up with a custom pattern to grok AsciiDoc mark-up to pick a label-looking line so that the hunks in patches to our documentation would be easier to find. A simpler and more generally applicable possibility is to find the previous line that starts a paragraph (e.g. you would pick "For .txt files..." for this part because it is the non-blank line that immediately follows the first blank line before this part). But I think the code to find an appropriate string for hunk header is not capable of looking at more than one line, so neither of these would be easy to implement without changing the underlying logic and semantics of "diff.*.funcname" configuration.

[Footnote]

*1* It may be misnamed but it is in line with GNU diff, though. They call -p "show-c-function" and -F "show-function-line" -- both assume function names are what people are interested in having on hunk headers.

Previous: Tsugikazu Shibata
Message 9 of 9 in “fix "git diff" to create wrong UTF-8 text”
  1. fix "git diff" to create wrong UTF-8 textTsugikazu Shibata, Jan 1, 2008
  2. Junio C HamanoJan 2, 2008
  3. 1/2 utf8_width(): allow non NUL-terminated inputJunio C Hamano, Jan 2, 2008
  4. 2/2 diff: do not chomp hunk-header in the middle of a characterJunio C Hamano, Jan 2, 2008
  5. 3/2 attribute "coding": specify blob encodingJunio C Hamano, Jan 2, 2008
  6. しらいしななこJan 3, 2008
  7. Junio C HamanoJan 3, 2008
  8. Tsugikazu ShibataJan 4, 2008
  9. Junio C HamanoJan 4, 2008

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.