git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: git@vger.kernel.org, Junio C Hamano <jch2355@gmail.com>,
	Jeff King <peff@peff.net>
Cc: kernel-team@fb.com
Subject: [PATCHSET] git-reverse-trailer-xrefs: Reverse map cherry-picks and other cross-references
Date: Tue, 11 Dec 2018 15:49:04 -0800	[thread overview]
Message-ID: <20181211234909.2855638-1-tj@kernel.org> (raw)

Hello,

Some trailers refer to other commits.  Let's call them xrefs
(cross-references).  For example, a cherry pick trailer points to the
source commit.  It is sometimes useful to build a reverse map of these
xrefs - ie. source -> cherry-pick instead of cherry-pick -> source.

This, e.g, can answer which releases a commit ended up in on
repositories which cherry-picks fixes back from the development
branch.  Let's say the repository looks like the following.

	  D'---E'' release-B
	 /
	C'      E' release-D
       /       /
  A---B---C---D---E master

where the followings cherry-picks took place.

  C -> C'
  D -> D'
  E -> E' -> E''

Using the reverse-mapping in this patchset, we can get the following
annotated log which succinctly shows which commit ended up where.

  $ git log --notes=xref-cherry-picks --oneline | git name-rev --name-only --stdin
  4b165af commit E
  Notes (xref-cherry-picks):
      Cherry-picked-to: release-D
      Cherry-picked-to:   release-B

  82bf1f3 commit D
  Notes (xref-cherry-picks):
      Cherry-picked-to: release-B~1

  364eccf commit C
  Notes (xref-cherry-picks):
      Cherry-picked-to: release-B~2

  ed3adf3 commit B
  ddd1bf2 commit A

This patchset implements generic trailer cross-reference
reverse-mapping and the necessary hooks and samples to keep
cherry-pick reverse-maps up-to-date.

diffstat follows.  Thanks.

 Documentation/git-cherry-pick.txt           |    5 
 Documentation/git-fetch.txt                 |    5 
 Documentation/git-notes.txt                 |    8 
 Documentation/git-reverse-trailer-xrefs.txt |  145 +++++++++++++++
 Documentation/githooks.txt                  |   23 ++
 Makefile                                    |    1 
 builtin.h                                   |    1 
 builtin/fetch.c                             |   72 +++++++
 builtin/reverse-trailer-xrefs.c             |  160 +++++++++++++++++
 builtin/revert.c                            |   14 +
 git.c                                       |    1 
 notes-merge.c                               |    9 
 notes-utils.c                               |    2 
 notes-utils.h                               |    3 
 notes.c                                     |  260 +++++++++++++++++++++++++++-
 notes.h                                     |    9 
 t/t3321-notes-xref-cherry-picks.sh          |  124 +++++++++++++
 templates/hooks--post-cherry-pick.sample    |    8 
 templates/hooks--post-fetch.sample          |   30 +++
 trailer.c                                   |  105 +++++++++++
 trailer.h                                   |   38 ++++
 21 files changed, 1015 insertions(+), 8 deletions(-)

--
tejun


             reply	other threads:[~2018-12-11 23:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 23:49 Tejun Heo [this message]
2018-12-11 23:49 ` [PATCH 1/5] trailer: Implement a helper to reverse-map trailer xrefs Tejun Heo
2018-12-11 23:49 ` [PATCH 2/5] notes: Implement special handlings for refs/notes/xref- Tejun Heo
2018-12-11 23:49 ` [PATCH 3/5] notes: Implement git-reverse-trailer-xrefs Tejun Heo
2018-12-11 23:49 ` [PATCH 4/5] githooks: Add post-cherry-pick and post-fetch hooks Tejun Heo
2018-12-11 23:49 ` [PATCH 5/5] notes: Implement xref-cherry-picks hooks and tests Tejun Heo
2018-12-12  7:26 ` [PATCHSET] git-reverse-trailer-xrefs: Reverse map cherry-picks and other cross-references Junio C Hamano
2018-12-12 14:54   ` Tejun Heo
2018-12-13  3:01     ` Junio C Hamano
2018-12-13  3:09       ` Junio C Hamano
2018-12-13  3:46         ` Tejun Heo
2018-12-18 14:40           ` Stefan Xenos
2018-12-18 16:48             ` Stefan Xenos
2018-12-18 16:51               ` Tejun Heo
2018-12-13  3:40       ` Tejun Heo
2018-12-13  5:47         ` Junio C Hamano
2018-12-13 16:15           ` Tejun Heo

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=20181211234909.2855638-1-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=git@vger.kernel.org \
    --cc=jch2355@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=peff@peff.net \
    /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).