git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ed Maste <emaste@freebsd.org>
To: Tom Clarkson <tqclarkson@icloud.com>
Cc: git@vger.kernel.org
Subject: Re: git-subtree split misbehaviour with a commit having empty ls-tree for the specified subdir
Date: Wed, 18 Dec 2019 05:23:06 -0500	[thread overview]
Message-ID: <CAPyFy2AKSVQJtSY0RNgJDJ5k1P=-gjNXVjDgPh+CdghhZtJXDw@mail.gmail.com> (raw)
In-Reply-To: <D4C58338-10C6-4E5A-BF1F-F48EC2EBDAD5@icloud.com>

On Tue, 17 Dec 2019 at 19:17, Tom Clarkson <tqclarkson@icloud.com> wrote:
>
> The algorithm I am looking at to replace the file based mainline detection is
>
>  - If subtree root is unknown (as on the initial split), everything is mainline.
>
>  - If subtree root is reachable and mainline root is not, it’s a subtree commit
>
>  - Otherwise, treat as mainline. This will also pick up commits from other subtrees but they hopefully won’t contain the subtree folder. I don’t think there is an unambiguous way to distinguish a subtree merge from a regular merge - the message produced is pretty generic. It may be possible to check reachability of all known subtrees, but that adds a fair bit of complexity.
>
> That leaves us with the question of how to record the empty mainline commits. The most correct result for your repro is probably four commits (add/delete everything/restore/modify), but I can see that falling over in a scenario where deleting a subtree is more like unlinking a library than editing that library to do nothing.
>
> Is it sufficiently correct for your scenario to treat ‘restore file1’ as the initial subtree commit?

My reproduction scenario is really a demonstration of the real issue I
encountered. Running the initial "subtree split" on the real repo
takes about 40 minutes so I wanted something trivial that shows the
same issue. In the demonstration case (i.e., actually removing and
readding the subtree) I think it's reasonable to start with the commit
that added it back.

Overall I think your proposed algorithm is reasonable (even though I
think it won't address some of the cases in our repo). Will your
algorithm allow us to pass $dir to git rev-list, for the initial
split?

My actual issue stems from the way svn2git converted some odd svn
history, and is described in more detail on the freebsd-git mailing
list at https://lists.freebsd.org/pipermail/freebsd-git/2019-November/000218.html.

Perhaps we can have some command-line options to provide metadata for
cases that cannot be inferred? The cases in our repo come from svn2git
creating subtree merges to represent updates from vendor code. AFAIK
these should be basically identical to what subtree creates, except
that we don't have any of the metadata it adds.

For a concrete example (from the repo at
https://github.com/freebsd/freebsd), 7f3a50b3b9f8 is a mainline commit
that added a new subtree, from 9ee787636908. I think that if I could
inform subtree split that 9ee787636908 is the root it would work for
me.

  reply	other threads:[~2019-12-18 17:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22 16:55 git-subtree split misbehaviour with a commit having empty ls-tree for the specified subdir Ed Maste
2019-12-18  0:17 ` Tom Clarkson
2019-12-18 10:23   ` Ed Maste [this message]
2019-12-19  0:57     ` Tom Clarkson
2019-12-20 15:56       ` Ed Maste
2019-12-22 14:01         ` Tom Clarkson
2020-01-21 22:36           ` Ed Maste
     [not found]         ` <DB65AE2F-12DE-43B7-8B20-4E173794CAF2@icloud.com>
2020-04-28 18:08           ` Ed Maste
2020-06-17 14:46         ` Ed Maste
2020-06-18  1:13           ` Tom Clarkson

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='CAPyFy2AKSVQJtSY0RNgJDJ5k1P=-gjNXVjDgPh+CdghhZtJXDw@mail.gmail.com' \
    --to=emaste@freebsd.org \
    --cc=git@vger.kernel.org \
    --cc=tqclarkson@icloud.com \
    /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).