Skip to content

Commit e4bd10b

Browse files
jnarebgitster
authored andcommitted
t9500: Add test for handling incomplete lines in diff by gitweb
Check that "commitdiff" action in gitweb can handle (without errors) incomplete lines as added and removed lines, and as context lines. Signed-off-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 970fac5 commit e4bd10b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

t/t9500-gitweb-standalone-no-errors.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,53 @@ test_expect_success \
273273
'commitdiff(2): directory becomes symlink' \
274274
'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"'
275275

276+
# ----------------------------------------------------------------------
277+
# commitdiff testing (incomplete lines)
278+
279+
test_expect_success 'setup incomplete lines' '
280+
cat >file<<-\EOF &&
281+
Dominus regit me,
282+
et nihil mihi deerit.
283+
In loco pascuae ibi me collocavit,
284+
super aquam refectionis educavit me;
285+
animam meam convertit,
286+
deduxit me super semitas jusitiae,
287+
propter nomen suum.
288+
CHANGE_ME
289+
EOF
290+
git commit -a -m "Preparing for incomplete lines" &&
291+
echo "incomplete" | tr -d "\\012" >>file &&
292+
git commit -a -m "Add incomplete line" &&
293+
git tag incomplete_lines_add &&
294+
sed -e s/CHANGE_ME/change_me/ <file >file+ &&
295+
mv -f file+ file &&
296+
git commit -a -m "Incomplete context line" &&
297+
git tag incomplete_lines_ctx &&
298+
echo "Dominus regit me," >file &&
299+
echo "incomplete line" | tr -d "\\012" >>file &&
300+
git commit -a -m "Change incomplete line" &&
301+
git tag incomplete_lines_chg
302+
echo "Dominus regit me," >file &&
303+
git commit -a -m "Remove incomplete line" &&
304+
git tag incomplete_lines_rem
305+
'
306+
307+
test_expect_success 'commitdiff(1): addition of incomplete line' '
308+
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_add"
309+
'
310+
311+
test_expect_success 'commitdiff(1): incomplete line as context line' '
312+
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_ctx"
313+
'
314+
315+
test_expect_success 'commitdiff(1): change incomplete line' '
316+
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_chg"
317+
'
318+
319+
test_expect_success 'commitdiff(1): removal of incomplete line' '
320+
gitweb_run "p=.git;a=commitdiff;h=incomplete_lines_rem"
321+
'
322+
276323
# ----------------------------------------------------------------------
277324
# commit, commitdiff: merge, large
278325
test_expect_success \

0 commit comments

Comments
 (0)