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

Re: [PATCH] Automatically line wrap long commit messages.

From
Shawn Pearce <spearce@spearce.org>
Date
May 31, 2006, 02:18 UTC
Message-ID
<20060531021808.GC21222@spearce.org>
In-Reply-To
<7vhd373o15.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 28 quoted lines
> Shawn Pearce <spearce@spearce.org> writes:
> 
> > OK.  Ignore both patches then.  Two negative votes in such a short
> > time suggests they are probably not generally accepted.  ;-)
> >
> >> We probably should allow "commit -F -" to read from the standard
> >> input if we already don't, but that is about as far as I am
> >> willing to go at this moment.
> >
> > We do.  So apparently the solution to my usage issue is:
> >
> > 	$ fmt -w 60 | git commit -F-
> > 	This is my message.
> >
> > 	This is the body.  Etc....
> > 	EOF
> >
> > I'm thinking that's too much work for me.
> 
> If we supported multiple -m (presumably each becomes a single line?)
> with internal fmt, I do not see how it would become less work.
> 
> 	$ git commit -w60 -m "This is my message." \
>         	-m '' \
>         	-m 'This is the body.  Etc....'
> 
> looks more typing to me, even without the second line to force
> the empty line between the summary and the body.

Actually I was thinking each -m would be its own paragraph so blank lines would split each -m and maybe the -w60 should be a config option in .git/config or .gitrc so it doesn't always need to be supplied on the command line.

Personally I want blank lines between each -m and to always run the message through fmt. Others may want to run their commit messages through other filters so maybe the filter itself is just a config value which gets executed:

	[user]
		commitMessageFilter = fmt -w 60
or someone else might set:
	[user]
		commitMessageFilter = /home/user/bin/my-filter

where the filter accepts the message on STDIN and writes (the maybe changed) message on STDOUT.

-- 
Shawn.
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 10 in “Automatically line wrap long commit messages.”
  1. Automatically line wrap long commit messages.Shawn Pearce, May 29, 2006
  2. Jan-Benedict GlawMay 29, 2006
  3. Shawn PearceMay 29, 2006
  4. Junio C HamanoMay 29, 2006
  5. Shawn PearceMay 29, 2006
  6. Junio C HamanoMay 30, 2006
  7. Shawn PearceMay 31, 2006
  8. Junio C HamanoMay 31, 2006
  9. Shawn PearceJun 1, 2006
  10. Junio C HamanoJun 1, 2006

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.