git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Ian Ward Comfort <icomfort@stanford.edu>,
	git@vger.kernel.org
Subject: Re: [PATCH v2] commit, status: #comment diff output in verbose mode
Date: Thu, 17 Mar 2011 09:01:33 +0100	[thread overview]
Message-ID: <4D81BFDD.7050009@drmicha.warpmail.net> (raw)
In-Reply-To: <20110317073719.GJ11931@sigill.intra.peff.net>

Jeff King venit, vidit, dixit 17.03.2011 08:37:
> On Fri, Mar 11, 2011 at 09:49:30AM +0100, Michael J Gruber wrote:
> 
>>> 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.
> 
>>> 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.

I resorted to using

git config diff.latin1.textconv "iconv -f latin1"

and setting a latin1 attribute on my (php) files (which use
institute-wide templates enforcing latin1).

This gives me better diffs also, of course. I just hadn't bothered so far.

Though I'm wondering whether we should do something about it in general
(we assume utf8 commit messages, don't we), at least in doc. Your
suggestion above does make things safer (so that you don't screw up the
commit message accidentally) and would make a good patch to vim's
filetype.vim

Michael

  reply	other threads:[~2011-03-17  8:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 19:59 [PATCH v2] commit, status: #comment diff output in verbose mode Ian Ward Comfort
2011-03-10 22:52 ` Jeff King
2011-03-10 23:57   ` SZEDER Gábor
2011-03-11  0:45   ` Junio C Hamano
2011-03-11  1:23     ` Jeff King
2011-03-11  5:31       ` Jeff King
2011-03-11  8:49         ` Michael J Gruber
2011-03-17  7:37           ` Jeff King
2011-03-17  8:01             ` Michael J Gruber [this message]
2011-03-17 19:41               ` Jeff King
2011-03-13 18:34       ` Piotr Krukowiecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D81BFDD.7050009@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=icomfort@stanford.edu \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).