All of lore.kernel.org
 help / color / mirror / Atom feed
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 15:15:56 +0200	[thread overview]
Message-ID: <87ppxmogdv.fsf@linux-k42r.v.cablecom.net> (raw)
In-Reply-To: <1366632487-28153-1-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Mon, 22 Apr 2013 17:38:07 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:
>

So after a long IRC discussion trying to hash out what you *want* it to
do, here's the summary for everyone else.  This test is wrong on several
counts.  For simplicity I'll denote by M the subtree merge, called
$new_h in the actual test.

> +test_expect_failure 'log pathspec in tree read into prefix' '
> +	git checkout --orphan subtree &&
> +	git rm -rf . &&
> +	echo foodle >ichi &&

'ichi' also exists in M^1 because you reused a name from another test.
So rename detection will never pair the eventual 'bar/ichi' with this
'ichi', because the 'ichi' path was *modified*, not deleted, w.r.t. M^1.

Just to clarify, rename detection is based on seeing

  A foo
  D bar

and changing that to

  R bar -> foo

assuming the blobs were reasonably similar.  And indeed, *copy*
detection (-C) is able to figure it out, because it considers all paths
that were modified as possible candidates for a copy source.

But --follow only uses rename detection.

> +	git add ichi &&
> +	test_tick &&
> +	git commit -m foom &&
> +	echo moodle >unrelated &&
> +	git add unrelated &&
> +	test_tick &&
> +	git commit -m quux &&
> +	subtree_h=$(git rev-parse HEAD) &&
> +	git checkout master &&
> +	orig_h=$(git rev-parse HEAD) &&
> +	git read-tree --prefix=bar $subtree_h &&

You need to supply a trailing / for the prefix, it's not implied.

> +	new_t=$(git write-tree) &&
> +	new_h=$(echo "new subtree" |
> +	git commit-tree $new_t -p $orig_h -p $subtree_h) &&
> +	git reset --hard $new_h &&
> +	(
> +		cd bar &&
> +		git log --oneline ichi >../actual

You need to use --follow, as otherwise the pathspec filtering is
considered fixed.

Note that as discussed in the rest of the thread, --follow is fairly
limited and doesn't *really* solve the problem.  But it does work
assuming the filenames are different and you only have one subtree
merge, like in this case.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  parent reply	other threads:[~2013-04-22 13:16 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 [this message]
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
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=87ppxmogdv.fsf@linux-k42r.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.