git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Calculating major.minor.patch from commit hash
@ 2020-02-13 14:40 Martin Vejnár
  2020-02-13 14:46 ` Randall S. Becker
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Vejnár @ 2020-02-13 14:40 UTC (permalink / raw)
  To: git

I'd like my releases to have major.minor.patch version number. While
increments of major.minor are something one has to do manually, I
don't want to do that for patch.

So I was thinking of having a VERSION file in the repo containing
major.minor and then calculate patch at the given commit C
automatically as the length of the longest path starting at C in the
subgraph containing only commits in which VERSION is the same as C's.

I can do that pretty easily right now by

* identifying commits in which VERSION changes with `git log --
VERSION` and then
* walking the graph in topo order with `git log --format=format:"%H %P"`.

The latter step can terminate early, so it doesn't have to walk the
entire repo, but the latter walks everything and can be quite slow.

Is there a more efficient way to do this?

If not, would there be an interest in a new builtin (git-depth?) that
would calculate the value?
-- 
Martin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-14  0:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 14:40 Calculating major.minor.patch from commit hash Martin Vejnár
2020-02-13 14:46 ` Randall S. Becker
2020-02-13 14:54   ` Martin Vejnár
2020-02-14  0:27     ` brian m. carlson

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).