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
SZEDER Gábor <szeder@ira.uka.de>
Date
Mar 10, 2011, 23:57 UTC
Message-ID
<20110310235703.GA15629@neumann>
In-Reply-To
<20110310225233.GH15828@sigill.intra.peff.net>
On Thu, Mar 10, 2011 at 05:52:33PM -0500, Jeff King wrote:
Show 27 quoted lines
> On Thu, Mar 10, 2011 at 11:59:00AM -0800, Ian Ward Comfort wrote:
> 
> > By historical accident, diffs included in commit templates and status
> > output when the "-v" option is given are not prefixed with the # comment
> > character, as other advice and status information is. Stripping these
> > lines is thus a best-effort operation, as it is not always possible to
> > tell which lines were generated by "-v" and which were inserted by the
> > user.
> > 
> > Improve this situation by adding the # prefix to diff output along with
> > all other status output in these cases. The change is simply made thanks
> > to a3c158d (Add a prefix output callback to diff output, 2010-05-26). The
> > prefixed diff can be stripped (or not, as configured) by the standard
> > cleanup code, so our special verbose-mode heuristic can be removed.
> > 
> > Documentation and a few tests which rely on the old "-v" format are
> > updated to match. One known breakage is fixed in t7507.
> 
> One reason to keep the existing behavior is that editors will tend to
> syntax-highlight the diff portion without much extra effort (in vim, at
> least, the syntax highlighting just includes the diff syntax
> highlighting for that section). I have no idea if this would make things
> much harder for that case or not.
> 
> Even if it does make things harder there, I am not sure that the
> increased robustness isn't more important, anyway. But I thought I would
> point it out.

We had robustness issues with 'git commit -v' in the past, and Junio's suggestion was to use "# Everything under this line is deleted." at the beginning of the commit message template, and do so after the editor exits. That would work with syntax highlighting (well, at least with vim), and perhaps isn't any less robust than prefixing the diff output with #.

http://thread.gmane.org/gmane.comp.version-control.git/100525/focus=100655

Best, Gábor

Previous: Jeff KingNext: Junio C Hamano
Message 3 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.