Merge branch 'jn/gitweb-side-by-side-diff'

* jn/gitweb-side-by-side-diff:
  gitweb: Add navigation to select side-by-side diff
  gitweb: Use href(-replay=>1,...) for formats links in "commitdiff"
  t9500: Add basic sanity tests for side-by-side diff in gitweb
  t9500: Add test for handling incomplete lines in diff by gitweb
  gitweb: Give side-by-side diff extra CSS styling
  gitweb: Add a feature to show side-by-side diff
  gitweb: Extract formatting of diff chunk header
  gitweb: Refactor diff body line classification
This commit is contained in:
Junio C Hamano
2011-12-13 22:46:57 -08:00
3 changed files with 354 additions and 90 deletions

View File

@ -273,6 +273,53 @@ test_expect_success \
'commitdiff(2): directory becomes symlink' \
'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"'
# ----------------------------------------------------------------------
# commitdiff testing (incomplete lines)
test_expect_success 'setup incomplete lines' '
cat >file<<-\EOF &&
Dominus regit me,
et nihil mihi deerit.
In loco pascuae ibi me collocavit,
super aquam refectionis educavit me;
animam meam convertit,
deduxit me super semitas jusitiae,
propter nomen suum.
CHANGE_ME
EOF
git commit -a -m "Preparing for incomplete lines" &&
echo "incomplete" | tr -d "\\012" >>file &&
git commit -a -m "Add incomplete line" &&
git tag incomplete_lines_add &&
sed -e s/CHANGE_ME/change_me/ <file >file+ &&
mv -f file+ file &&
git commit -a -m "Incomplete context line" &&
git tag incomplete_lines_ctx &&
echo "Dominus regit me," >file &&
echo "incomplete line" | tr -d "\\012" >>file &&
git commit -a -m "Change incomplete line" &&
git tag incomplete_lines_chg
echo "Dominus regit me," >file &&
git commit -a -m "Remove incomplete line" &&
git tag incomplete_lines_rem
'
test_expect_success 'commitdiff(1): addition of incomplete line' '
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add"
'
test_expect_success 'commitdiff(1): incomplete line as context line' '
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx"
'
test_expect_success 'commitdiff(1): change incomplete line' '
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg"
'
test_expect_success 'commitdiff(1): removal of incomplete line' '
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem"
'
# ----------------------------------------------------------------------
# commit, commitdiff: merge, large
test_expect_success \
@ -282,7 +329,8 @@ test_expect_success \
git add b &&
git commit -a -m "On branch" &&
git checkout master &&
git pull . b'
git pull . b &&
git tag merge_commit'
test_expect_success \
'commit(0): merge commit' \
@ -331,6 +379,29 @@ test_expect_success \
'commitdiff(1): large commit' \
'gitweb_run "p=.git;a=commitdiff;h=b"'
# ----------------------------------------------------------------------
# side-by-side diff
test_expect_success 'side-by-side: addition of incomplete line' '
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add;ds=sidebyside"
'
test_expect_success 'side-by-side: incomplete line as context line' '
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx;ds=sidebyside"
'
test_expect_success 'side-by-side: changed incomplete line' '
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg;ds=sidebyside"
'
test_expect_success 'side-by-side: removal of incomplete line' '
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem;ds=sidebyside"
'
test_expect_success 'side-by-side: merge commit' '
gitweb_run "p=.git;a=commitdiff;h=merge_commit;ds=sidebyside"
'
# ----------------------------------------------------------------------
# tags testing