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.mdWhat 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 '