From: "Martin Vejnár" <vejnar.martin@gmail.com>
To: git@vger.kernel.org
Subject: Calculating major.minor.patch from commit hash
Date: Thu, 13 Feb 2020 15:40:55 +0100 [thread overview]
Message-ID: <CAJFfRmt65DV5bZa5yTvg9sDb8SS8dFFyX7Zm23T7mAHL58v1Lw@mail.gmail.com> (raw)
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
next reply other threads:[~2020-02-13 14:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 14:40 Martin Vejnár [this message]
2020-02-13 14:46 ` Calculating major.minor.patch from commit hash Randall S. Becker
2020-02-13 14:54 ` Martin Vejnár
2020-02-14 0:27 ` brian m. carlson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJFfRmt65DV5bZa5yTvg9sDb8SS8dFFyX7Zm23T7mAHL58v1Lw@mail.gmail.com \
--to=vejnar.martin@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).