[PATCHSET] git-reverse-trailer-xrefs: Reverse map cherry-picks and other cross-references
- From
- Tejun Heo <tj@kernel.org>
- Date
- Dec 11, 2018, 23:49 UTC
- Message-ID
- <20181211234909.2855638-1-tj@kernel.org>
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 masterwhere 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~2ed3adf3 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