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

Pretty format specifier for commit count?

From
Josh Triplett <josh@joshtriplett.org>
Date
Jan 19, 2015, 01:29 UTC
Message-ID
<20150119012926.GA24004@thin>

I'd like to use git-log to generate a Debian changelog file (with one entry per commit), which has entries like this:

package-name (version-number) unstable; urgency=low
 * ...
 -- Example Person <person@example.org>  RFC822-date

Since I'm intentionally generating one entry per commit, I can generate *almost* all of this with git log:

git log --pretty='format:packagename (FIXME) unstable; urgency=low%n%n  * %s%n%w(0,4,4)%+b%w(0,0,0)%n -- %an <%ae>  %aD%n'
This produces entries like this:
packagename (FIXME) unstable; urgency=low
  * Example change
    Long description of example change.
 -- Josh Triplett <josh@joshtriplett.org>  Thu, 8 Jan 2015 16:36:52 -0800
packagename (FIXME) unstable; urgency=low
  * Initial version
 -- Josh Triplett <josh@joshtriplett.org>  Thu, 8 Jan 2015 16:36:51 -0800

Would it be possible to add a format specifier producing a commit count, similar to that provided by git-describe? Such a specifier would allow filling in the version number in the format above (replacing the FIXME). (Note that the version numbers need to monotonically increase; otherwise I would just use the commit hash as the version numer.)

- Josh Triplett
Next: Michael J Gruber
Message 1 of 7 in “Pretty format specifier for commit count?”
  1. Josh TriplettJan 19, 2015
  2. Michael J GruberJan 19, 2015
  3. Josh TriplettJan 20, 2015
  4. Jeff KingJan 20, 2015
  5. josh@joshtriplett.orgJan 20, 2015
  6. Michael J GruberJan 22, 2015
  7. Jeff KingJan 22, 2015

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.