t / t9500-gitweb-standalone-no-errors.shon commit Add tests for git log --pretty, --format and --oneline. (bb93afd)
   1#!/bin/sh
   2#
   3# Copyright (c) 2007 Jakub Narebski
   4#
   5
   6test_description='gitweb as standalone script (basic tests).
   7
   8This test runs gitweb (git web interface) as CGI script from
   9commandline, and checks that it would not write any errors
  10or warnings to log.'
  11
  12gitweb_init () {
  13        safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
  14        cat >gitweb_config.perl <<EOF
  15#!/usr/bin/perl
  16
  17# gitweb configuration for tests
  18
  19our \$version = "current";
  20our \$GIT = "git";
  21our \$projectroot = "$safe_pwd";
  22our \$project_maxdepth = 8;
  23our \$home_link_str = "projects";
  24our \$site_name = "[localhost]";
  25our \$site_header = "";
  26our \$site_footer = "";
  27our \$home_text = "indextext.html";
  28our @stylesheets = ("file:///$TEST_DIRECTORY/../gitweb/gitweb.css");
  29our \$logo = "file:///$TEST_DIRECTORY/../gitweb/git-logo.png";
  30our \$favicon = "file:///$TEST_DIRECTORY/../gitweb/git-favicon.png";
  31our \$projects_list = "";
  32our \$export_ok = "";
  33our \$strict_export = "";
  34
  35EOF
  36
  37        cat >.git/description <<EOF
  38$0 test repository
  39EOF
  40}
  41
  42gitweb_run () {
  43        GATEWAY_INTERFACE="CGI/1.1"
  44        HTTP_ACCEPT="*/*"
  45        REQUEST_METHOD="GET"
  46        SCRIPT_NAME="$TEST_DIRECTORY/../gitweb/gitweb.perl"
  47        QUERY_STRING=""$1""
  48        PATH_INFO=""$2""
  49        export GATEWAY_INTERFACE HTTP_ACCEPT REQUEST_METHOD \
  50                SCRIPT_NAME QUERY_STRING PATH_INFO
  51
  52        GITWEB_CONFIG=$(pwd)/gitweb_config.perl
  53        export GITWEB_CONFIG
  54
  55        # some of git commands write to STDERR on error, but this is not
  56        # written to web server logs, so we are not interested in that:
  57        # we are interested only in properly formatted errors/warnings
  58        rm -f gitweb.log &&
  59        perl -- "$SCRIPT_NAME" \
  60                >/dev/null 2>gitweb.log &&
  61        if grep "^[[]" gitweb.log >/dev/null 2>&1; then false; else true; fi
  62
  63        # gitweb.log is left for debugging
  64}
  65
  66safe_chmod () {
  67        chmod "$1" "$2" &&
  68        if [ "$(git config --get core.filemode)" = false ]
  69        then
  70                git update-index --chmod="$1" "$2"
  71        fi
  72}
  73
  74. ./test-lib.sh
  75
  76perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || {
  77    test_expect_success 'skipping gitweb tests, perl version is too old' :
  78    test_done
  79    exit
  80}
  81
  82gitweb_init
  83
  84# ----------------------------------------------------------------------
  85# no commits (empty, just initialized repository)
  86
  87test_expect_success \
  88        'no commits: projects_list (implicit)' \
  89        'gitweb_run'
  90test_debug 'cat gitweb.log'
  91
  92test_expect_success \
  93        'no commits: projects_index' \
  94        'gitweb_run "a=project_index"'
  95test_debug 'cat gitweb.log'
  96
  97test_expect_success \
  98        'no commits: .git summary (implicit)' \
  99        'gitweb_run "p=.git"'
 100test_debug 'cat gitweb.log'
 101
 102test_expect_success \
 103        'no commits: .git commit (implicit HEAD)' \
 104        'gitweb_run "p=.git;a=commit"'
 105test_debug 'cat gitweb.log'
 106
 107test_expect_success \
 108        'no commits: .git commitdiff (implicit HEAD)' \
 109        'gitweb_run "p=.git;a=commitdiff"'
 110test_debug 'cat gitweb.log'
 111
 112test_expect_success \
 113        'no commits: .git tree (implicit HEAD)' \
 114        'gitweb_run "p=.git;a=tree"'
 115test_debug 'cat gitweb.log'
 116
 117test_expect_success \
 118        'no commits: .git heads' \
 119        'gitweb_run "p=.git;a=heads"'
 120test_debug 'cat gitweb.log'
 121
 122test_expect_success \
 123        'no commits: .git tags' \
 124        'gitweb_run "p=.git;a=tags"'
 125test_debug 'cat gitweb.log'
 126
 127
 128# ----------------------------------------------------------------------
 129# initial commit
 130
 131test_expect_success \
 132        'Make initial commit' \
 133        'echo "Not an empty file." > file &&
 134         git add file &&
 135         git commit -a -m "Initial commit." &&
 136         git branch b'
 137
 138test_expect_success \
 139        'projects_list (implicit)' \
 140        'gitweb_run'
 141test_debug 'cat gitweb.log'
 142
 143test_expect_success \
 144        'projects_index' \
 145        'gitweb_run "a=project_index"'
 146test_debug 'cat gitweb.log'
 147
 148test_expect_success \
 149        '.git summary (implicit)' \
 150        'gitweb_run "p=.git"'
 151test_debug 'cat gitweb.log'
 152
 153test_expect_success \
 154        '.git commit (implicit HEAD)' \
 155        'gitweb_run "p=.git;a=commit"'
 156test_debug 'cat gitweb.log'
 157
 158test_expect_success \
 159        '.git commitdiff (implicit HEAD, root commit)' \
 160        'gitweb_run "p=.git;a=commitdiff"'
 161test_debug 'cat gitweb.log'
 162
 163test_expect_success \
 164        '.git commitdiff_plain (implicit HEAD, root commit)' \
 165        'gitweb_run "p=.git;a=commitdiff_plain"'
 166test_debug 'cat gitweb.log'
 167
 168test_expect_success \
 169        '.git commit (HEAD)' \
 170        'gitweb_run "p=.git;a=commit;h=HEAD"'
 171test_debug 'cat gitweb.log'
 172
 173test_expect_success \
 174        '.git tree (implicit HEAD)' \
 175        'gitweb_run "p=.git;a=tree"'
 176test_debug 'cat gitweb.log'
 177
 178test_expect_success \
 179        '.git blob (file)' \
 180        'gitweb_run "p=.git;a=blob;f=file"'
 181test_debug 'cat gitweb.log'
 182
 183test_expect_success \
 184        '.git blob_plain (file)' \
 185        'gitweb_run "p=.git;a=blob_plain;f=file"'
 186test_debug 'cat gitweb.log'
 187
 188# ----------------------------------------------------------------------
 189# nonexistent objects
 190
 191test_expect_success \
 192        '.git commit (non-existent)' \
 193        'gitweb_run "p=.git;a=commit;h=non-existent"'
 194test_debug 'cat gitweb.log'
 195
 196test_expect_success \
 197        '.git commitdiff (non-existent)' \
 198        'gitweb_run "p=.git;a=commitdiff;h=non-existent"'
 199test_debug 'cat gitweb.log'
 200
 201test_expect_success \
 202        '.git commitdiff (non-existent vs HEAD)' \
 203        'gitweb_run "p=.git;a=commitdiff;hp=non-existent;h=HEAD"'
 204test_debug 'cat gitweb.log'
 205
 206test_expect_success \
 207        '.git tree (0000000000000000000000000000000000000000)' \
 208        'gitweb_run "p=.git;a=tree;h=0000000000000000000000000000000000000000"'
 209test_debug 'cat gitweb.log'
 210
 211test_expect_success \
 212        '.git tag (0000000000000000000000000000000000000000)' \
 213        'gitweb_run "p=.git;a=tag;h=0000000000000000000000000000000000000000"'
 214test_debug 'cat gitweb.log'
 215
 216test_expect_success \
 217        '.git blob (non-existent)' \
 218        'gitweb_run "p=.git;a=blob;f=non-existent"'
 219test_debug 'cat gitweb.log'
 220
 221test_expect_success \
 222        '.git blob_plain (non-existent)' \
 223        'gitweb_run "p=.git;a=blob_plain;f=non-existent"'
 224test_debug 'cat gitweb.log'
 225
 226
 227# ----------------------------------------------------------------------
 228# commitdiff testing (implicit, one implicit tree-ish)
 229
 230test_expect_success \
 231        'commitdiff(0): root' \
 232        'gitweb_run "p=.git;a=commitdiff"'
 233test_debug 'cat gitweb.log'
 234
 235test_expect_success \
 236        'commitdiff(0): file added' \
 237        'echo "New file" > new_file &&
 238         git add new_file &&
 239         git commit -a -m "File added." &&
 240         gitweb_run "p=.git;a=commitdiff"'
 241test_debug 'cat gitweb.log'
 242
 243test_expect_success \
 244        'commitdiff(0): mode change' \
 245        'safe_chmod +x new_file &&
 246         git commit -a -m "Mode changed." &&
 247         gitweb_run "p=.git;a=commitdiff"'
 248test_debug 'cat gitweb.log'
 249
 250test_expect_success \
 251        'commitdiff(0): file renamed' \
 252        'git mv new_file renamed_file &&
 253         git commit -a -m "File renamed." &&
 254         gitweb_run "p=.git;a=commitdiff"'
 255test_debug 'cat gitweb.log'
 256
 257test_expect_success \
 258        'commitdiff(0): file to symlink' \
 259        'rm renamed_file &&
 260         ln -s file renamed_file &&
 261         git commit -a -m "File to symlink." &&
 262         gitweb_run "p=.git;a=commitdiff"'
 263test_debug 'cat gitweb.log'
 264
 265test_expect_success \
 266        'commitdiff(0): file deleted' \
 267        'git rm renamed_file &&
 268         rm -f renamed_file &&
 269         git commit -a -m "File removed." &&
 270         gitweb_run "p=.git;a=commitdiff"'
 271test_debug 'cat gitweb.log'
 272
 273test_expect_success \
 274        'commitdiff(0): file copied / new file' \
 275        'cp file file2 &&
 276         git add file2 &&
 277         git commit -a -m "File copied." &&
 278         gitweb_run "p=.git;a=commitdiff"'
 279test_debug 'cat gitweb.log'
 280
 281test_expect_success \
 282        'commitdiff(0): mode change and modified' \
 283        'echo "New line" >> file2 &&
 284         safe_chmod +x file2 &&
 285         git commit -a -m "Mode change and modification." &&
 286         gitweb_run "p=.git;a=commitdiff"'
 287test_debug 'cat gitweb.log'
 288
 289test_expect_success \
 290        'commitdiff(0): renamed and modified' \
 291        'cat >file2<<EOF &&
 292Dominus regit me,
 293et nihil mihi deerit.
 294In loco pascuae ibi me collocavit,
 295super aquam refectionis educavit me;
 296animam meam convertit,
 297deduxit me super semitas jusitiae,
 298propter nomen suum.
 299EOF
 300         git commit -a -m "File added." &&
 301         git mv file2 file3 &&
 302         echo "Propter nomen suum." >> file3 &&
 303         git commit -a -m "File rename and modification." &&
 304         gitweb_run "p=.git;a=commitdiff"'
 305test_debug 'cat gitweb.log'
 306
 307test_expect_success \
 308        'commitdiff(0): renamed, mode change and modified' \
 309        'git mv file3 file2 &&
 310         echo "Propter nomen suum." >> file2 &&
 311         safe_chmod +x file2 &&
 312         git commit -a -m "File rename, mode change and modification." &&
 313         gitweb_run "p=.git;a=commitdiff"'
 314test_debug 'cat gitweb.log'
 315
 316# ----------------------------------------------------------------------
 317# commitdiff testing (taken from t4114-apply-typechange.sh)
 318
 319test_expect_success 'setup typechange commits' '
 320        echo "hello world" > foo &&
 321        echo "hi planet" > bar &&
 322        git update-index --add foo bar &&
 323        git commit -m initial &&
 324        git branch initial &&
 325        rm -f foo &&
 326        ln -s bar foo &&
 327        git update-index foo &&
 328        git commit -m "foo symlinked to bar" &&
 329        git branch foo-symlinked-to-bar &&
 330        rm -f foo &&
 331        echo "how far is the sun?" > foo &&
 332        git update-index foo &&
 333        git commit -m "foo back to file" &&
 334        git branch foo-back-to-file &&
 335        rm -f foo &&
 336        git update-index --remove foo &&
 337        mkdir foo &&
 338        echo "if only I knew" > foo/baz &&
 339        git update-index --add foo/baz &&
 340        git commit -m "foo becomes a directory" &&
 341        git branch "foo-becomes-a-directory" &&
 342        echo "hello world" > foo/baz &&
 343        git update-index foo/baz &&
 344        git commit -m "foo/baz is the original foo" &&
 345        git branch foo-baz-renamed-from-foo
 346        '
 347
 348test_expect_success \
 349        'commitdiff(2): file renamed from foo to foo/baz' \
 350        'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-baz-renamed-from-foo"'
 351test_debug 'cat gitweb.log'
 352
 353test_expect_success \
 354        'commitdiff(2): file renamed from foo/baz to foo' \
 355        'gitweb_run "p=.git;a=commitdiff;hp=foo-baz-renamed-from-foo;h=initial"'
 356test_debug 'cat gitweb.log'
 357
 358test_expect_success \
 359        'commitdiff(2): directory becomes file' \
 360        'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=initial"'
 361test_debug 'cat gitweb.log'
 362
 363test_expect_success \
 364        'commitdiff(2): file becomes directory' \
 365        'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-becomes-a-directory"'
 366test_debug 'cat gitweb.log'
 367
 368test_expect_success \
 369        'commitdiff(2): file becomes symlink' \
 370        'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-symlinked-to-bar"'
 371test_debug 'cat gitweb.log'
 372
 373test_expect_success \
 374        'commitdiff(2): symlink becomes file' \
 375        'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-back-to-file"'
 376test_debug 'cat gitweb.log'
 377
 378test_expect_success \
 379        'commitdiff(2): symlink becomes directory' \
 380        'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-becomes-a-directory"'
 381test_debug 'cat gitweb.log'
 382
 383test_expect_success \
 384        'commitdiff(2): directory becomes symlink' \
 385        'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"'
 386test_debug 'cat gitweb.log'
 387
 388# ----------------------------------------------------------------------
 389# commit, commitdiff: merge, large
 390test_expect_success \
 391        'Create a merge' \
 392        'git checkout b &&
 393         echo "Branch" >> b &&
 394         git add b &&
 395         git commit -a -m "On branch" &&
 396         git checkout master &&
 397         git pull . b'
 398
 399test_expect_success \
 400        'commit(0): merge commit' \
 401        'gitweb_run "p=.git;a=commit"'
 402test_debug 'cat gitweb.log'
 403
 404test_expect_success \
 405        'commitdiff(0): merge commit' \
 406        'gitweb_run "p=.git;a=commitdiff"'
 407test_debug 'cat gitweb.log'
 408
 409test_expect_success \
 410        'Prepare large commit' \
 411        'git checkout b &&
 412         echo "To be changed" > 01-change &&
 413         echo "To be renamed" > 02-pure-rename-from &&
 414         echo "To be deleted" > 03-delete &&
 415         echo "To be renamed and changed" > 04-rename-from &&
 416         echo "To have mode changed" > 05-mode-change &&
 417         echo "File to symlink" > 06-file-or-symlink &&
 418         echo "To be changed and have mode changed" > 07-change-mode-change     &&
 419         git add 0* &&
 420         git commit -a -m "Prepare large commit" &&
 421         echo "Changed" > 01-change &&
 422         git mv 02-pure-rename-from 02-pure-rename-to &&
 423         git rm 03-delete && rm -f 03-delete &&
 424         echo "A new file" > 03-new &&
 425         git add 03-new &&
 426         git mv 04-rename-from 04-rename-to &&
 427         echo "Changed" >> 04-rename-to &&
 428         safe_chmod +x 05-mode-change &&
 429         rm -f 06-file-or-symlink && ln -s 01-change 06-file-or-symlink &&
 430         echo "Changed and have mode changed" > 07-change-mode-change   &&
 431         safe_chmod +x 07-change-mode-change &&
 432         git commit -a -m "Large commit" &&
 433         git checkout master'
 434
 435test_expect_success \
 436        'commit(1): large commit' \
 437        'gitweb_run "p=.git;a=commit;h=b"'
 438test_debug 'cat gitweb.log'
 439
 440test_expect_success \
 441        'commitdiff(1): large commit' \
 442        'gitweb_run "p=.git;a=commitdiff;h=b"'
 443test_debug 'cat gitweb.log'
 444
 445# ----------------------------------------------------------------------
 446# tags testing
 447
 448test_expect_success \
 449        'tags: list of different types of tags' \
 450        'git checkout master &&
 451         git tag -a -m "Tag commit object" tag-commit HEAD &&
 452         git tag -a -m "" tag-commit-nomessage HEAD &&
 453         git tag -a -m "Tag tag object" tag-tag tag-commit &&
 454         git tag -a -m "Tag tree object" tag-tree HEAD^{tree} &&
 455         git tag -a -m "Tag blob object" tag-blob HEAD:file &&
 456         git tag lightweight/tag-commit HEAD &&
 457         git tag lightweight/tag-tag tag-commit &&
 458         git tag lightweight/tag-tree HEAD^{tree} &&
 459         git tag lightweight/tag-blob HEAD:file &&
 460         gitweb_run "p=.git;a=tags"'
 461test_debug 'cat gitweb.log'
 462
 463test_expect_success \
 464        'tag: Tag to commit object' \
 465        'gitweb_run "p=.git;a=tag;h=tag-commit"'
 466test_debug 'cat gitweb.log'
 467
 468test_expect_success \
 469        'tag: on lightweight tag (invalid)' \
 470        'gitweb_run "p=.git;a=tag;h=lightweight/tag-commit"'
 471test_debug 'cat gitweb.log'
 472
 473# ----------------------------------------------------------------------
 474# logs
 475
 476test_expect_success \
 477        'logs: log (implicit HEAD)' \
 478        'gitweb_run "p=.git;a=log"'
 479test_debug 'cat gitweb.log'
 480
 481test_expect_success \
 482        'logs: shortlog (implicit HEAD)' \
 483        'gitweb_run "p=.git;a=shortlog"'
 484test_debug 'cat gitweb.log'
 485
 486test_expect_success \
 487        'logs: history (implicit HEAD, file)' \
 488        'gitweb_run "p=.git;a=history;f=file"'
 489test_debug 'cat gitweb.log'
 490
 491test_expect_success \
 492        'logs: history (implicit HEAD, non-existent file)' \
 493        'gitweb_run "p=.git;a=history;f=non-existent"'
 494test_debug 'cat gitweb.log'
 495
 496test_expect_success \
 497        'logs: history (implicit HEAD, deleted file)' \
 498        'git checkout master &&
 499         echo "to be deleted" > deleted_file &&
 500         git add deleted_file &&
 501         git commit -m "Add file to be deleted" &&
 502         git rm deleted_file &&
 503         git commit -m "Delete file" &&
 504         gitweb_run "p=.git;a=history;f=deleted_file"'
 505test_debug 'cat gitweb.log'
 506
 507# ----------------------------------------------------------------------
 508# path_info links
 509test_expect_success \
 510        'path_info: project' \
 511        'gitweb_run "" "/.git"'
 512test_debug 'cat gitweb.log'
 513
 514test_expect_success \
 515        'path_info: project/branch' \
 516        'gitweb_run "" "/.git/b"'
 517test_debug 'cat gitweb.log'
 518
 519test_expect_success \
 520        'path_info: project/branch:file' \
 521        'gitweb_run "" "/.git/master:file"'
 522test_debug 'cat gitweb.log'
 523
 524test_expect_success \
 525        'path_info: project/branch:dir/' \
 526        'gitweb_run "" "/.git/master:foo/"'
 527test_debug 'cat gitweb.log'
 528
 529test_expect_success \
 530        'path_info: project/branch:file (non-existent)' \
 531        'gitweb_run "" "/.git/master:non-existent"'
 532test_debug 'cat gitweb.log'
 533
 534test_expect_success \
 535        'path_info: project/branch:dir/ (non-existent)' \
 536        'gitweb_run "" "/.git/master:non-existent/"'
 537test_debug 'cat gitweb.log'
 538
 539
 540test_expect_success \
 541        'path_info: project/branch:/file' \
 542        'gitweb_run "" "/.git/master:/file"'
 543test_debug 'cat gitweb.log'
 544
 545test_expect_success \
 546        'path_info: project/:/file (implicit HEAD)' \
 547        'gitweb_run "" "/.git/:/file"'
 548test_debug 'cat gitweb.log'
 549
 550test_expect_success \
 551        'path_info: project/:/ (implicit HEAD, top tree)' \
 552        'gitweb_run "" "/.git/:/"'
 553test_debug 'cat gitweb.log'
 554
 555
 556# ----------------------------------------------------------------------
 557# feed generation
 558
 559test_expect_success \
 560        'feeds: OPML' \
 561        'gitweb_run "a=opml"'
 562test_debug 'cat gitweb.log'
 563
 564test_expect_success \
 565        'feed: RSS' \
 566        'gitweb_run "p=.git;a=rss"'
 567test_debug 'cat gitweb.log'
 568
 569test_expect_success \
 570        'feed: Atom' \
 571        'gitweb_run "p=.git;a=atom"'
 572test_debug 'cat gitweb.log'
 573
 574# ----------------------------------------------------------------------
 575# encoding/decoding
 576
 577test_expect_success \
 578        'encode(commit): utf8' \
 579        '. "$TEST_DIRECTORY"/t3901-utf8.txt &&
 580         echo "UTF-8" >> file &&
 581         git add file &&
 582         git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt &&
 583         gitweb_run "p=.git;a=commit"'
 584test_debug 'cat gitweb.log'
 585
 586test_expect_success \
 587        'encode(commit): iso-8859-1' \
 588        '. "$TEST_DIRECTORY"/t3901-8859-1.txt &&
 589         echo "ISO-8859-1" >> file &&
 590         git add file &&
 591         git config i18n.commitencoding ISO-8859-1 &&
 592         git commit -F "$TEST_DIRECTORY"/t3900/ISO-8859-1.txt &&
 593         git config --unset i18n.commitencoding &&
 594         gitweb_run "p=.git;a=commit"'
 595test_debug 'cat gitweb.log'
 596
 597test_expect_success \
 598        'encode(log): utf-8 and iso-8859-1' \
 599        'gitweb_run "p=.git;a=log"'
 600test_debug 'cat gitweb.log'
 601
 602# ----------------------------------------------------------------------
 603# extra options
 604
 605test_expect_success \
 606        'opt: log --no-merges' \
 607        'gitweb_run "p=.git;a=log;opt=--no-merges"'
 608test_debug 'cat gitweb.log'
 609
 610test_expect_success \
 611        'opt: atom --no-merges' \
 612        'gitweb_run "p=.git;a=log;opt=--no-merges"'
 613test_debug 'cat gitweb.log'
 614
 615test_expect_success \
 616        'opt: "file" history --no-merges' \
 617        'gitweb_run "p=.git;a=history;f=file;opt=--no-merges"'
 618test_debug 'cat gitweb.log'
 619
 620test_expect_success \
 621        'opt: log --no-such-option (invalid option)' \
 622        'gitweb_run "p=.git;a=log;opt=--no-such-option"'
 623test_debug 'cat gitweb.log'
 624
 625test_expect_success \
 626        'opt: tree --no-merges (invalid option for action)' \
 627        'gitweb_run "p=.git;a=tree;opt=--no-merges"'
 628test_debug 'cat gitweb.log'
 629
 630# ----------------------------------------------------------------------
 631# testing config_to_multi / cloneurl
 632
 633test_expect_success \
 634       'URL: no project URLs, no base URL' \
 635       'gitweb_run "p=.git;a=summary"'
 636test_debug 'cat gitweb.log'
 637
 638test_expect_success \
 639       'URL: project URLs via gitweb.url' \
 640       'git config --add gitweb.url git://example.com/git/trash.git &&
 641        git config --add gitweb.url http://example.com/git/trash.git &&
 642        gitweb_run "p=.git;a=summary"'
 643test_debug 'cat gitweb.log'
 644
 645cat >.git/cloneurl <<\EOF
 646git://example.com/git/trash.git
 647http://example.com/git/trash.git
 648EOF
 649
 650test_expect_success \
 651       'URL: project URLs via cloneurl file' \
 652       'gitweb_run "p=.git;a=summary"'
 653test_debug 'cat gitweb.log'
 654
 655# ----------------------------------------------------------------------
 656# gitweb config and repo config
 657
 658cat >>gitweb_config.perl <<EOF
 659
 660\$feature{'blame'}{'override'} = 1;
 661\$feature{'snapshot'}{'override'} = 1;
 662EOF
 663
 664test_expect_success \
 665        'config override: tree view, features not overridden in repo config' \
 666        'gitweb_run "p=.git;a=tree"'
 667test_debug 'cat gitweb.log'
 668
 669test_expect_success \
 670        'config override: tree view, features disabled in repo config' \
 671        'git config gitweb.blame no &&
 672         git config gitweb.snapshot none &&
 673         gitweb_run "p=.git;a=tree"'
 674test_debug 'cat gitweb.log'
 675
 676test_expect_success \
 677        'config override: tree view, features enabled in repo config (1)' \
 678        'git config gitweb.blame yes &&
 679         git config gitweb.snapshot "zip,tgz, tbz2" &&
 680         gitweb_run "p=.git;a=tree"'
 681test_debug 'cat gitweb.log'
 682
 683cat >.git/config <<\EOF
 684# testing noval and alternate separator
 685[gitweb]
 686        blame
 687        snapshot = zip tgz
 688EOF
 689test_expect_success \
 690        'config override: tree view, features enabled in repo config (2)' \
 691        'gitweb_run "p=.git;a=tree"'
 692test_debug 'cat gitweb.log'
 693
 694# ----------------------------------------------------------------------
 695# non-ASCII in README.html
 696
 697test_expect_success \
 698        'README.html with non-ASCII characters (utf-8)' \
 699        'echo "<b>UTF-8 example:</b><br />" > .git/README.html &&
 700         cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >> .git/README.html &&
 701         gitweb_run "p=.git;a=summary"'
 702test_debug 'cat gitweb.log'
 703
 704test_done