* [PATCH] t4202 (log): add test for --follow over a merge
@ 2013-04-22 15:18 Ramkumar Ramachandra
2013-04-23 6:28 ` Jonathan Nieder
0 siblings, 1 reply; 2+ messages in thread
From: Ramkumar Ramachandra @ 2013-04-22 15:18 UTC (permalink / raw)
To: Git List; +Cc: Avery Pennarun, Junio C Hamano
The --follow feature can be used to follow the history of a file over
a merge commit, and is useful even when the file hasn't been
copied/renamed. Add a test to show off this feature.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
I haven't updated the documentation, because I can't claim to
understand --follow fully without reading the code (doing that now).
In the meantime, I'm contributing a patch I wrote out originally as
an example for Thomas Rast to prove a point.
Where should this go? What is t4206-log-follow-harder-copies (it
just has one test which isn't even that special)? Should we move all
the --follow tests out of this file and put it in a separate file?
t/t4202-log.sh | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 523c1be..5b041fd 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -168,6 +168,35 @@ test_expect_success 'git log --follow' '
'
+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
+'
+
test_expect_failure 'log pathspec in tree read into prefix' '
git checkout --orphan subtree &&
git rm -rf . &&
--
1.8.2.1.546.gea3475a
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] t4202 (log): add test for --follow over a merge
2013-04-22 15:18 [PATCH] t4202 (log): add test for --follow over a merge Ramkumar Ramachandra
@ 2013-04-23 6:28 ` Jonathan Nieder
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Nieder @ 2013-04-23 6:28 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: Git List, Avery Pennarun, Junio C Hamano
Hi,
Ramkumar Ramachandra wrote:
> The --follow feature can be used to follow the history of a file over
> a merge commit, and is useful even when the file hasn't been
> copied/renamed. Add a test to show off this feature.
I can't claim to have followed the discussion, but I don't understand
the above. If the file's name hasn't changed, the most one can hope
for is that --follow doesn't hurt, no?
[...]
> + 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
t/README explains:
| As with any programming projects, existing programs are the best
| source of the information. However, do _not_ emulate
| t0000-basic.sh when writing your tests. The test is special in
| that it tries to validate the very core of GIT.
[...]
| other tests that simply rely on basic parts of the core
| GIT working properly should not have that level of intimate
| knowledge of the core GIT internals. If all the test scripts
| hardcoded the object IDs like t0000-basic.sh does, that defeats
| the purpose of t0000-basic.sh, which is to isolate that level of
| validation in one place.
Hard-coding object names makes it painful to tweak a given test and
tests that come before it, lest a timestamp or the phase of moon
change and cause the object names to drift. Don't do it, except
in t0000.
Hope that helps,
Jonathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-23 6:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-22 15:18 [PATCH] t4202 (log): add test for --follow over a merge Ramkumar Ramachandra
2013-04-23 6:28 ` Jonathan Nieder
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).