Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Name the followed path in the diffstat header
With follow set the diff runs over the whole commit and show_filepair
applies the path, so the header read (limited to '') whether or not a
path was given.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0107-diff.sh | 22 |
1 file changed, 22 insertions, 0 deletions
diff --git a/tests/t0107-diff.sh b/tests/t0107-diff.sh index 1f12220..861ca44 100755 --- a/tests/t0107-diff.sh +++ b/tests/t0107-diff.sh @@ -170,6 +170,28 @@ test_expect_success 'so does the commit page limited to the new name' ' ! grep "a/file-1 b/file-1" tmp ' +# Following a file diffs the whole commit and keeps the pairs on that path, +# and the header still names the path rather than the empty limit the walk +# runs under. +test_expect_success 'a followed file is diffed as the rename alone' ' + cgitrc_repo followrc moved enable-follow-links=1 && + cgit_ok followrc "url=moved/diff/new.txt&follow=1" >tmp && + grep "diff --git a/old.txt b/new.txt" tmp && + grep "Diffstat</a> (limited to .new.txt.)</div>" tmp && + grep "<div class=.diffstat-summary.>1 file changed, 0 insertions, 0 deletions</div>" tmp && + ! grep "a/file-1 b/file-1" tmp && + cgit_ok followrc "url=moved/commit/new.txt&follow=1" >tmp && + grep "diff --git a/old.txt b/new.txt" tmp && + grep "Diffstat</a> (limited to .new.txt.)</div>" tmp && + ! grep "a/file-1 b/file-1" tmp +' + +test_expect_success 'following with no path limits nothing' ' + cgit_ok followrc "url=moved/commit/&follow=1" >tmp && + grep "diff --git a/file-1 b/file-1" tmp && + grep "<div class=.diffstat-header.><a href=[^>]*>Diffstat</a></div>" tmp +' + test_expect_success 'a file added outright still shows as new' ' added=$(git -C repos/moved rev-parse HEAD~1) && cgit_ok movedrc "url=moved/diff/old.txt&id=$added" >tmp && |
