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 test for --follow over a merge
Date: Mon, 22 Apr 2013 20:48:32 +0530 [thread overview]
Message-ID: <1366643912-3942-1-git-send-email-artagnon@gmail.com> (raw)
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
next reply other threads:[~2013-04-22 15:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-22 15:18 Ramkumar Ramachandra [this message]
2013-04-23 6:28 ` [PATCH] t4202 (log): add test for --follow over a merge Jonathan Nieder
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=1366643912-3942-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).