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

Re: Associating tags with changelogs

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 5, 2008, 04:06 UTC
Message-ID
<20080505040646.GK29038@spearce.org>
In-Reply-To
<218b69370805042040h66d02979jac6bd64456a9d304@mail.gmail.com>
Zack Brown <zacharyb@gmail.com> wrote:
Show 8 quoted lines
> I'm using git to extract changelog entries into a MySQL database, and
> I want to be able to associate each changelog with the official
> release in which it first appears. [...]
> 
> My script keeps track of the most recent changelog entry that it has
> processed into the MySQL database, so the next time it runs, it picks
> up from that entry, using "`git-log sha1string.. --pretty=fuller", and
> inserts only the changelogs since that entry into the database.
...
> Is there a command to do that? I don't see anything in the man pages for it.

No, not really. The way to do this is either invoke `git describe --contains $sha1` for each commit, or to keep track of it yourself in the script.

The algorithm is really simple, especially if you have something like Math::BigInt in Perl. Make a list of all tags, assign a bit to each tag, make a hash of commits to BigInt (bitset of tags that contain the commit).

Then run `git rev-list --all --parents --not sha1string` (where sha1string is the last commit you added to the database) and copy the bits of each commit onto its parents until the end of input.

Later loop through those commits again. If a commit's parent has a color for a tag but the commit doesn't have that tag, then that tag is the first time the commit appeared in a tag.

-- 
Shawn.
Previous: Zack Brown
Message 4 of 4 in “Associating tags with changelogs”
  1. Zack BrownMay 5, 2008
  2. Kevin BallardMay 5, 2008
  3. Zack BrownMay 5, 2008
  4. Shawn O. PearceMay 5, 2008

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.