diff options
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0103-log.sh38
1 file changed, 38 insertions, 0 deletions
diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh
index 16fabda..08f9ddd 100755
--- a/tests/t0103-log.sh
+++ b/tests/t0103-log.sh
@@ -45,4 +45,42 @@ test_expect_success 'no links with space in path' '! grep "href=./with space/" t
test_expect_success 'no links with space in arg' '! grep "q=commit 1" tmp'
test_expect_success 'commit 2 is not visible' '! grep "commit 2" tmp'
+# Following a file diffs each commit for the name the file had there, so the
+# root commit that created it has to be diffed too.
+test_expect_success 'set up a renamed file to follow' '
+ test_create_repo repos/fol &&
+ (
+ cd repos/fol &&
+ echo 1 >a.txt &&
+ git add a.txt &&
+ git commit -m "create a" &&
+ for i in 2 3 4
+ do
+ echo $i >>a.txt &&
+ git commit -am "edit a $i" || return 1
+ done &&
+ git mv a.txt b.txt &&
+ git commit -m "rename to b" &&
+ for i in 6 7 8
+ do
+ echo $i >>b.txt &&
+ git commit -am "edit b $i" || return 1
+ done
+ ) &&
+ {
+ echo "virtual-root=/" &&
+ echo "cache-size=0" &&
+ echo "enable-follow-links=1" &&
+ echo "max-commit-count=3" &&
+ echo "repo.url=fol" &&
+ echo "repo.path=$PWD/repos/fol/.git"
+ } >folrc
+'
+
+test_expect_success 'a followed log reaches the root commit' '
+ CGIT_CONFIG="$PWD/folrc" QUERY_STRING="url=fol/log/b.txt&follow=1&ofs=6" cgit >tmp &&
+ grep ">edit a 2<" tmp &&
+ grep ">create a<" tmp
+'
+
test_done