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

Re: commit summary, --pretty=short and other tools

From
Andreas Ericsson <ae@op5.se>
Date
Sep 18, 2007, 07:19 UTC
Message-ID
<46EF7BF7.3070107@op5.se>
In-Reply-To
<55887C88-8523-4839-8B91-236256A5E893@lrde.epita.fr>
Benoit SIGOURE wrote:
> 
> My opinion is that it would be better to keep the first line and never 
> ever rewrite the commit messages.
> 

I've had reason to ponder this quite a lot, as I've imported 15 repos from CVS and SVN where the commit authors did not follow the git-recommended way of doing things, but rather put everything as one paragraph, usually without linebreaks, in the commit message.

>From what I've read from those rather horrid commit-messages so far, it's

usually correct to grab the first sentence in case the empty line isn't there, so:

const char *find_commit_subject_end(const char *commit_msg)
{
	const char *dot, *paragraph_end;
	
	paragraph_end = strstr(commit_msg, "\n\n");
	dot = strchr(commit_msg, '.');
	
	return min_non_null(dot, paragraph_end); 
}
would probably get it right very nearly always.

I'll submit a patch in 3 hours when I get my lunch, unless someone beats me to it.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Junio C HamanoNext: Johannes Schindelin
Message 5 of 10 in “commit summary, --pretty=short and other tools”
  1. Mike HommeySep 17, 2007
  2. Jeff KingSep 17, 2007
  3. Benoit SIGOURESep 17, 2007
  4. Junio C HamanoSep 18, 2007
  5. Andreas EricssonSep 18, 2007
  6. Johannes SchindelinSep 18, 2007
  7. Andreas EricssonSep 18, 2007
  8. Benoit SIGOURESep 18, 2007
  9. Johannes SchindelinSep 18, 2007
  10. Wincent ColaiutaSep 18, 2007

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.