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 <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
Oct 31, 2011 at 00:36 UTC
e4bd10b2cd30e91cfbfb59d9f1876cc1977515a2
1 file changed
+47
t/t9500-gitweb-standalone-no-errors.sh
+47
@@ -273,6 +273,53 @@ test_expect_success \
273
'commitdiff(2): directory becomes symlink' \
274
'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"'
275
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
+
323
# ----------------------------------------------------------------------
324
# commit, commitdiff: merge, large
325
test_expect_success \