git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Avery Pennarun <apenwarr@gmail.com>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] t4202 (log): add failing test for log with subtree
Date: Mon, 22 Apr 2013 17:38:07 +0530	[thread overview]
Message-ID: <1366632487-28153-1-git-send-email-artagnon@gmail.com> (raw)

When using 'git subtree' to add an external project at a given prefix,
log of a pathspec within the prefix fails to give the expected output.
This failure can be interpreted as log expecting all trees to be read
into /.  Document this bug by adding a failing test.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 I normally don't use git-subtree, but happened to notice this when I
 was checking it out: a 'git log <pathspec>', when referring to a file
 inside the subtree, doesn't work as expected: it only displays the
 HEAD commit.  I know this is not related to git-subtree at all, and
 has to do with how 'git log' (and probably 'git merge -Xsubtree',
 'git merge -s subtree') works.  I suspect that 'git log' expects all
 trees to be read into /, and I've tried to prove this with a failing
 test.

 I think this is a bug, but I might be missing something.  Can someone
 tell me what is actually happening?

 t/t4202-log.sh | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 9243a97..523c1be 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -168,6 +168,37 @@ test_expect_success 'git log --follow' '
 
 '
 
+test_expect_failure 'log pathspec in tree read into prefix' '
+	git checkout --orphan subtree &&
+	git rm -rf . &&
+	echo foodle >ichi &&
+	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 &&
+	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
+	) &&
+	cat >expect <<-\EOF &&
+	61dcd8e new subtree
+	130a8fb foom
+	EOF
+	git reset --hard HEAD~1 &&
+	test_cmp expect actual
+'
+
 cat > expect << EOF
 804a787 sixth
 394ef78 fifth
-- 
1.8.2.1.546.gea3475a

             reply	other threads:[~2013-04-22 12:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22 12:08 Ramkumar Ramachandra [this message]
2013-04-22 12:11 ` [PATCH] t4202 (log): add failing test for log with subtree 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
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=1366632487-28153-1-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=apenwarr@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 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).