git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] t4202 (log): add failing test for log with subtree

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Apr 22, 2013, 12:08 UTC
Message-ID
<1366632487-28153-1-git-send-email-artagnon@gmail.com>

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
Next: Matthieu Moy
Message 1 of 34 in “t4202 (log): add failing test for log with subtree”
  1. t4202 (log): add failing test for log with subtreeRamkumar Ramachandra, Apr 22, 2013
  2. Matthieu MoyApr 22, 2013
  3. Thomas RastApr 22, 2013
  4. Ramkumar RamachandraApr 22, 2013
  5. Ramkumar RamachandraApr 22, 2013
  6. Ramkumar RamachandraApr 22, 2013
  7. Matthieu MoyApr 22, 2013
  8. Thomas RastApr 22, 2013
  9. Thomas RastApr 22, 2013
  10. Ramkumar RamachandraApr 22, 2013
  11. Ramkumar RamachandraApr 22, 2013
  12. Thomas RastApr 22, 2013
  13. Ramkumar RamachandraApr 22, 2013
  14. Ramkumar RamachandraApr 22, 2013
  15. Ramkumar RamachandraApr 22, 2013
  16. Ramkumar RamachandraApr 22, 2013
  17. Thomas RastApr 22, 2013
  18. Ramkumar RamachandraApr 22, 2013
  19. Philip OakleyApr 22, 2013
  20. Ramkumar RamachandraApr 22, 2013
  21. Ramkumar RamachandraApr 22, 2013
  22. Matthieu MoyApr 22, 2013
  23. Junio C HamanoApr 22, 2013
  24. Ramkumar RamachandraApr 22, 2013
  25. Ramkumar RamachandraApr 22, 2013
  26. Junio C HamanoApr 22, 2013
  27. Ramkumar RamachandraApr 23, 2013
  28. Junio C HamanoApr 23, 2013
  29. Ramkumar RamachandraApr 23, 2013
  30. Junio C HamanoApr 22, 2013
  31. Ramkumar RamachandraApr 22, 2013
  32. Matthieu MoyApr 22, 2013
  33. Junio C HamanoApr 22, 2013
  34. Ramkumar RamachandraApr 22, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.