]> git.ipfire.org Git - thirdparty/haproxy.git/commit
SCRIPTS: git-show-backports: automatic ref and base detection with -m
authorWilly Tarreau <w@1wt.eu>
Mon, 14 Aug 2023 11:03:46 +0000 (13:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Aug 2023 11:12:56 +0000 (13:12 +0200)
commitf97db23b6d7e0c6d8d07f11b6ee7dcfbf373f6aa
treec6f8fd4e7e7fc884e4f41c5e2721b8fb2a7e1ec7
parentd5590ef633a94675d592579fdee5d97ec4d5f02a
SCRIPTS: git-show-backports: automatic ref and base detection with -m

When running with -m (check for missing backports) we often have to fill
lots of information that can be determined automatically the vast majority
of the time:
  - restart point (last cherry-picked ID from one of the last commits)
  - current branch (HEAD)
  - reference branch (the one that contains most of the last commits)

These elements are not that hard to determine, so let's make sure we
can fall back to them when running in missing mode.

The reference branch is guessed by looking at the upstream branch that
most frequently contains some of the last 10 commits. It can be inaccurate
if multiple branches exist with these commits, or when upstream changes
due to a non-LTS branch disappearing in the middle of the series, in which
case passing "-r" will help. But most of the time it works OK. It also gives
precedence to local branches over remote ones for such choices. A test in
2.4 at commit 793a4b520 correctly shows 2.6/master as the upstream despite
2.5 having been used for the early ones of the tag.

For the restart point, we assume that the most recent commit that was
backported serves as a reference (and not the most recently backported
commit). This means that the usual case where an old commit was found
to be missing will not fool the analysis. Commits are inspected from
2 commits before the last tag, and reordered from the parent's tree
to see which one is the last one.

With this, it's sufficient to issue "git-show-backports -q -m" to get
the list of backports from the upstream branch, restarting from the
last backported one.
scripts/git-show-backports