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

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

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Apr 22, 2013, 14:30 UTC
Message-ID
<CALkWK0m6vwR9rNNw_GjF4MOK1GZfwjB8ZA5Y0Lo8LbvfAg0g3g@mail.gmail.com>
In-Reply-To
<87ppxmogdv.fsf@linux-k42r.v.cablecom.net>
Thomas Rast wrote:
> [...]

I think you've misunderstood the whole thing. The histories of M^1 and M^2 are completely unrelated: they're from different projects altogether. Considering the /ichi in M^2 a "rename" of the /ichi in M^1 is completely wrong. They have nothing to do with each other. I intentionally named it "ichi" in my orphan branch just to drive my point. I suspect you've got confused because I used an orphan branch to emulate a different project's history. If you want an end-user understanding of the problem, use git subtree:

    $ cd /tmp
    $ git clone gh:artagnon/varlog
    $ cd varlog
    $ git subtree add --prefix=clayoven \
       gh:artagnon/clayoven master
    $ cd clayoven
    $ git log README.md

What do you expect? The same output you would get if you cloned gh:artagnon/clayoven separately and executed 'git log README.md' on it.

Now, clayoven's README.md (the one in HEAD^2) has nothing to do with varlog's README.md (the one in HEAD^1). It's just incidental that both projects have a README.md. I repeat: clayoven and varlog have _nothing_ to do with each other. If I say git log --follow README.md in the above example, I don't even get the HEAD commit. And I wouldn't expect to either.

I will repeat this: --follow has nothing to do with the problem I've specified. And it is not tied to "renaming" (ie. changing the name/path of a file) as you've made it look. If you're still not convinced, I've included a testcase for --follow "following" over a merge commit (include it after the --follow test in the t4202). Try it without the --follow and you'll see what I mean. Neither the filename nor the filepath of ichi has changed in this example.

-- 8< --
test_expect_success '--follow over merge' '
	git checkout -b featurebranch
	echo foodle >>ichi &&
	git add ichi &&
	test_tick &&
	git commit -m "add a line to the end of ichi" &&
	echo moodle >unrelated &&
	git add unrelated &&
	test_tick &&
	git commit -m quux &&
	git checkout master &&
	mv ichi ichi.bak &&
	echo gooble >ichi &&
	cat ichi.bak >>ichi &&
	git add ichi &&
	test_tick &&
	git commit -m "add a line to the beginning of ichi" &&
	git merge featurebranch &&
	git log --follow --oneline ichi >actual &&
	cat >expect <<-\EOF &&
	df26551 add a line to the beginning of ichi
	882d8d9 add a line to the end of ichi
	2fbe8c0 third
	f7dab8e second
	3a2fdcb initial
	EOF
	test_cmp expect actual
'
Previous: Thomas RastNext: Ramkumar Ramachandra
Message 10 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.