[RFC] [PATCH 0/5] Implement 'prior' commit object links
From: Sam Vilain <hidden>
Date: 2016-06-15 22:42:24
This patch series implements "prior" links in commit objects. A
'prior' link on a commit represents its historical precedent, as
opposed to the previous commit(s) that this commit builds upon.
This is a proof of concept only; there is an outstanding bug (I put
the prior header right after parent, when it should really go after
author/committer), and room for improvement no doubt remain elsewhere.
Not to mention my shocking C coding style ;)
Examples of use cases this helps:
1. heads that represent topic branch merges
This is the "pu" branch case, where the head is a merge of several
topic branches that is continually moved forward.
topic branches head
,___. ,___.
| TA1 | | TB1 |
`---' `---' ,__.
^\_____^\____| H1 |
`--'
+ some topic branch changes and a republish:
,___. ,___.
| TA1 | | TB1 |
`---' `---'^ ,__.
|^\_____^\____| H1 |
| | `--'
,_|_. ,_|_. P
| TA2 | | TB2 | |
`---' `---'^ |
^ ^ |
,_|_. | |
| TA3 | | |
`---' | ,__.
^\______\____| H2 |
`--'
key: ^ = parent P = prior
2. revising published commits / re-basing
This is what "stg" et al do. The tools allow you to commit,
rewind, revise, recommit, fast forward, etc.
In this case, the "prior" link would point to the last revision of
a patch. Tools would probably
3. sub-projects
In this case, the commit on the "main" commit line would have a
"prior" link to the commit on the sub-project. The sub-project
would effectively be its own head with copied commits objects on
the main head.
4. tracking cherry picking
In this case, the "prior" link just points to the commit that was
cherry picked. This is perhaps a little different, but an idea
that somebody else had for this feature.
Sam.