From: Thomas Rast <trast@inf.ethz.ch>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>,
Avery Pennarun <apenwarr@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] t4202 (log): add failing test for log with subtree
Date: Mon, 22 Apr 2013 21:15:10 +0200 [thread overview]
Message-ID: <87zjwqpebl.fsf@hexa.v.cablecom.net> (raw)
In-Reply-To: <CALkWK0k0LbAnkhAAqdeAvBnCig_HO+bT+WiQuQQ3Fgc=FzFtRw@mail.gmail.com> (Ramkumar Ramachandra's message of "Mon, 22 Apr 2013 22:59:48 +0530")
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> Ramkumar Ramachandra wrote:
>> And if you're still not convinced, run 'git log HEAD^2 -- README.md'
>> from the toplevel directory. You'll get the log of README.md from the
>> subproject.
>
> On IRC, Thomas explained to me that mixing in changes from various
> branches into the pathspec will break this so-called determinism. To
> try it out for yourself, do:
>
> $ cd /tmp
> $ git clone gh:trast/subtree-mainline-example
> $ cd subtree-mainline-example
> $ git log HEAD^2 -- sub # only lists the side changes
> $ git log -- dir/sub # only lists the mainline changes
>
> What we should really expect is a mix of the two.
So after lots of confusing misunderstandings across the entire thread,
and a long IRC discussion, I do have one take-away that I think is worth
writing down:
There is a market for a rename detection that works at the tree level.
Bear with me while I explain.
The average subtree merge (after the initial one) looks like this,
focusing on the subtree:
M new state in sub/
| \
| * new state in /
|
* old state in sub/
(The example in the quote above additionally complicates the issue by
changing sub/ in the mainline.)
Ideally we'd like our hypothetical fixed --follow to accurately track a
pathspec 'sub/foo' so that in the mainline it remains the same, but in
the side it becomes 'foo'. Because of reasons already explained in
earlier mails, -M does not suffice for all cases (in particular, it
fails if there is a /foo in the mainline too). -C works, but is slow.
So how can we fix that? We could try to somehow figure out that M:sub/
refers to the same thing as M^2:/, by looking at them at the tree level.
Let's provisionally call this --follow-tree-rename.
I don't quite know how to heuristically[1] detect such a rename, but
since 'merge -ssubtree' does it (if you don't specify a tree prefix
explicitly), it can't be That Hard(tm). If we're extra lucky it's fast
enough to be enabled by default.
In the special case where the subtree was not modified in the mainline
since the last merge, the problem is pretty trivial: simply check if any
subtree of M agrees with the root tree of each merge parent; if so, diff
those trees instead of the root trees.
That should then help subtree users to get better logs.
[1] the quoted example shows that you can't just go looking for
identical trees in the general case, so it is really a heuristic
--
Thomas Rast
trast@{inf,student}.ethz.ch
next prev parent reply other threads:[~2013-04-22 19:15 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-22 12:08 [PATCH] t4202 (log): add failing test for log with subtree Ramkumar Ramachandra
2013-04-22 12:11 ` Matthieu Moy
2013-04-22 12:17 ` Thomas Rast
2013-04-22 12:37 ` Ramkumar Ramachandra
2013-04-22 12:54 ` Ramkumar Ramachandra
2013-04-22 12:29 ` Ramkumar Ramachandra
2013-04-22 12:36 ` Matthieu Moy
2013-04-22 13:15 ` Thomas Rast
2013-04-22 13:19 ` Thomas Rast
2013-04-22 14:30 ` Ramkumar Ramachandra
2013-04-22 14:57 ` Ramkumar Ramachandra
2013-04-22 15:24 ` Thomas Rast
2013-04-22 15:46 ` Ramkumar Ramachandra
2013-04-22 15:50 ` Ramkumar Ramachandra
2013-04-22 15:54 ` Ramkumar Ramachandra
2013-04-22 17:29 ` Ramkumar Ramachandra
2013-04-22 19:15 ` Thomas Rast [this message]
2013-04-22 19:54 ` Ramkumar Ramachandra
2013-04-22 21:00 ` Philip Oakley
2013-04-22 21:08 ` Ramkumar Ramachandra
2013-04-22 21:23 ` Ramkumar Ramachandra
2013-04-22 21:06 ` Matthieu Moy
2013-04-22 21:59 ` Junio C Hamano
2013-04-22 22:52 ` Ramkumar Ramachandra
2013-04-22 22:59 ` Ramkumar Ramachandra
2013-04-22 23:55 ` Junio C Hamano
2013-04-23 7:53 ` Ramkumar Ramachandra
2013-04-23 16:03 ` Junio C Hamano
2013-04-23 16:29 ` Ramkumar Ramachandra
2013-04-22 16:32 ` Junio C Hamano
2013-04-22 18:00 ` Ramkumar Ramachandra
2013-04-22 18:18 ` Matthieu Moy
2013-04-22 19:09 ` Junio C Hamano
2013-04-22 20:39 ` Ramkumar Ramachandra
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=87zjwqpebl.fsf@hexa.v.cablecom.net \
--to=trast@inf.ethz.ch \
--cc=apenwarr@gmail.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.