git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Josh Triplett <josh@joshtriplett.org>
Cc: git@vger.kernel.org
Subject: Re: Properties of trees referencing commit objects (mode 160000)?
Date: Mon, 21 Mar 2016 01:57:13 -0400	[thread overview]
Message-ID: <20160321055712.GA21568@sigill.intra.peff.net> (raw)
In-Reply-To: <20160320232202.GB20803@x>

On Sun, Mar 20, 2016 at 04:22:02PM -0700, Josh Triplett wrote:

> I want to track the evolution of a patch series or other commit history,
> through non-fast-forwarding actions like rebase, rebase -i, or commit
> --amend.  Similar in spirit to reflog, but with intentional commits and
> commit messages, and most importantly with the ability to share and
> collaborate on it.  For each version of the patch series, I plan to
> track the commit at the end of the series, and optionally the commit at
> the base of the patch series (to simplify tracking of rebasing); I'll
> use the tree object associated with the commit to track the cover
> letter, and perhaps meta-changelog entries associated with v2/v3/vN of
> the series.
> 
> Patch series almost always need to evolve through non-fast-forwarding
> history.  And I've seen that done in two ways: either pull the patch
> series out of git, put it in quilt or similar, and track the quilt
> series with git; or pull the versioning of the patch series out of git
> and track it with branch names like feature-v2, feature-2016-03-20,
> feature-rebased, and feature-rebased-4.4-fixed-foo-fixed-bar.  That last
> one closely matches a real-world example I've recently seen.  And that
> starts to look a lot like the naming of files and documents in
> organizations that haven't yet discovered the wonders of version
> control.
> 
> I'd like to have the best of both worlds: handle the patch series in
> git, *and* handle the versioning of the patch series in git.

It seems like you could represent this in git by storing a merge commit
for each revision of the patch series, with one parent as the current
real tip of the series, and the other as the merge-commit for the
previous revision of the series. The tree would be the same as current
tip commit's tree. You could store metadata about the series in the
merge commits (presumably including some marker to say "I'm a special
series-revision commit, not a regular merge").

That's roughly the same as having "feature-v1", "feature-v2", etc, in a
tree, except that you have to walk down the parent pointers to discover
each entry, rather than walking the tree.

The resulting history would be viewable with naive "git log", but you
would probably want to use "--first-parent" to see just the revisions,
or some to-be-invented option to see just the most recent commits (e.g.,
something like: if the commit subject is "magic-token: my-series", then
skip this commit, show the second parent, and then walk down the first
parent chain, skipping commits until we hit a commit that doesn't have
"magic-token: my-series" in it).

And it would just work for transferring revisions. You'd probably have
one ref per patch series (pointing to the marker commit of the most
recent version), and the "real" clean history of the project would never
include any of the revision markers at all (though it could if you
really wanted to).

But I will be the first to admit that I haven't thought too hard on
this. It may even be that I just unconsciously regurgitated somebody
else's storage scheme. Once upon a time I was interesting in "topgit",
"guilt", and other tools, but I haven't looked at them in years.

So it may well be that somebody tried something like this, and already
discovered its downsides. :)

-Peff

  reply	other threads:[~2016-03-21  5:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-19 22:13 Properties of trees referencing commit objects (mode 160000)? Josh Triplett
2016-03-20  4:18 ` Jeff King
2016-03-20 18:45   ` Josh Triplett
2016-03-20 20:07     ` Jeff King
2016-03-20 23:22       ` Josh Triplett
2016-03-21  5:57         ` Jeff King [this message]
2016-03-21 15:36           ` Josh Triplett
2016-03-20 22:30     ` Junio C Hamano
2016-03-20 22:43       ` Josh Triplett

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=20160321055712.GA21568@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=josh@joshtriplett.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).