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

Re: [PATCH v2] commit, status: #comment diff output in verbose mode

From
Jeff King <peff@peff.net>
Date
Mar 17, 2011, 07:37 UTC
Message-ID
<20110317073719.GJ11931@sigill.intra.peff.net>
In-Reply-To
<4D79E21A.3040007@drmicha.warpmail.net>
On Fri, Mar 11, 2011 at 09:49:30AM +0100, Michael J Gruber wrote:
Show 13 quoted lines
> > I do still think I prefer the "#" as comment lines, though. Editors
> > understand that concept pretty well. For example, one thing that happens
> > to me a lot is that I write a paragraph, then edit it, then ask the
> > editor to re-wrap it. Inevitably it buts against the "#" lines, and
> > those get re-wrapped, too. I could fix it, of course, but I don't bother
> > because the editor knows that the stuff on "#" lines should remain on
> > "#" lines. So as it is now, the git-status output gets scrambled, but I
> > don't have to care. With a special "# Lines below this one..." line, I
> > will have mangled it and get extra cruft in my commit message.
> 
> As long as we match for the first n characters of that line with n<60 or
> so the rewrapping will do no harm (assuming you leave it to start a new
> paragraph, i.e. "^#Lines..." stays "^#Lines...").
Yeah, that would work in my case.
Show 6 quoted lines
> > But I admit that this is one pretty bizarre personal anecdote and might
> > not affect anyone else.
> 
> What affects me more is when when I track files in a different encoding
> (latin1, say), the diff triggers that encoding for vim and I end up with
> encoding issues for the commit message (which is supposed to be utf8)...

Yuck. You may be literally feeding different charsets into a single buffer of the editor. The best you could do is something like:

  au BufNewFile,BufRead COMMIT_EDITMSG set fenc=utf-8

and then for an empty commit message, vim will read in the latin1, and then convert it to utf-8 on output. You will not have munged the "diff" line, so git will still recognize it and remove everything after. But if you are amending, then you will feed it a utf-8 commit message along with a latin1 diff. And vim will screw that up when reading it in.

-Peff
Previous: Michael J GruberNext: Michael J Gruber
Message 8 of 11 in “commit, status: #comment diff output in verbose mode”
  1. commit, status: #comment diff output in verbose modeIan Ward Comfort, Mar 10, 2011
  2. Jeff KingMar 10, 2011
  3. SZEDER GáborMar 10, 2011
  4. Junio C HamanoMar 11, 2011
  5. Jeff KingMar 11, 2011
  6. Jeff KingMar 11, 2011
  7. Michael J GruberMar 11, 2011
  8. Jeff KingMar 17, 2011
  9. Michael J GruberMar 17, 2011
  10. Jeff KingMar 17, 2011
  11. Piotr KrukowieckiMar 13, 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.