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