{"thread":{"id":"6213","subject":"[PATCH] gitweb: Fix \"Use of uninitialized value\" warning in git_tags_body","startedAt":"2007-01-03T21:54:29Z","lastAt":"2007-01-07T02:40:00Z","messageCount":4,"participants":["Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"30775","messageId":"11678612691404-git-send-email-jnareb@gmail.com","threadId":"6213","inReplyTo":null,"subject":"[PATCH] gitweb: Fix \"Use of uninitialized value\" warning in git_tags_body","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-03T21:54:29Z","receivedAt":"2007-01-03T21:54:29Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Fix \"Use of uninitialized value\" warning in git_tags_body generated\nfor lightweight tags of tree and blob object; those don't have age\n($tag{'age'}) defined.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 2179054..fd671f3 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2813,8 +2813,12 @@ sub git_tags_body {\n \t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n \t\t}\n \t\t$alternate ^= 1;\n-\t\tprint \"<td><i>$tag{'age'}</i></td>\\n\" .\n-\t\t      \"<td>\" .\n+\t\tif (defined $tag{'age'}) {\n+\t\t\tprint \"<td><i>$tag{'age'}</i></td>\\n\";\n+\t\t} else {\n+\t\t\tprint \"<td></td>\\n\";\n+\t\t}\n+\t\tprint \"<td>\" .\n \t\t      $cgi->a({-href => href(action=>$tag{'reftype'}, hash=>$tag{'refid'}),\n \t\t               -class => \"list name\"}, esc_html($tag{'name'})) .\n \t\t      \"</td>\\n\" .\n-- \n1.4.4.3\n"},{"id":"30777","messageId":"enh9h8$7l0$2@sea.gmane.org","threadId":"6213","inReplyTo":"11678612691404-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Fix \"Use of uninitialized value\" warning in git_tags_body","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-03T22:11:53Z","receivedAt":"2007-01-03T22:11:53Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jakub Narebski wrote:\n\n> Fix \"Use of uninitialized value\" warning in git_tags_body generated\n> for lightweight tags of tree and blob object; those don't have age\n> ($tag{'age'}) defined.\n\nBy the way, the latest \"Fix warnings\" patches for gitweb were result\nof working on bare bones test suite for gitweb. For now I'm only\nchecking if there was anything written to STDERR.\n\nBTW how in portable way to check that given file matches given patterns\nin specified order, or matches given patterns in any order?\n\nBelow current version of script.\n\n#!/bin/sh\n#\n# Copyright (c) 2007 Jakub Narebski\n#\n\ntest_description='gitweb as standalone script (basic tests).\n\nThis test runs gitweb (git web interface) as CGI script from\ncommandline, and checks that it does not spew any errors\nor warnings.'\n\ngitweb_init () {\n        cat >gitweb_config.perl <<EOF\n#!/usr/bin/perl\n\n# gitweb configuration for tests\n\nour \\$version = \"current\";\nour \\$GIT = \"git\";\nour \\$projectroot = \"$(pwd)\";\nour \\$home_link_str = \"projects\";\nour \\$site_name = \"[localhost]\";\nour \\$site_header = \"\";\nour \\$site_footer = \"\";\nour \\$home_text = \"indextext.html\";\nour @stylesheets = (\"file:///$(pwd)/../../gitweb/gitweb.css\");\nour \\$logo = \"file:///$(pwd)/../../gitweb/git-logo.png\";\nour \\$favicon = \"file:///$(pwd)/../../gitweb/git-favicon.png\";\nour \\$projects_list = \"\";\nour \\$export_ok = \"\";\nour \\$strict_export = \"\";\nEOF\n}\n\ngitweb_run () {\n        export GATEWAY_INTERFACE=\"CGI/1.1\"\n        export HTTP_ACCEPT=\"*/*\"\n        export REQUEST_METHOD=\"GET\"\n        export QUERY_STRING=\"\"$1\"\"\n        export PATH_INFO=\"\"$2\"\"\n\n        export GITWEB_CONFIG=$(pwd)/gitweb_config.perl\n\n        rm -f gitweb.log &&\n        perl -- $(pwd)/../../gitweb/gitweb.perl \\\n                >/dev/null 2>gitweb.log &&\n        test ! -s gitweb.log\n}\n\n. ./test-lib.sh\n\ngitweb_init\n\n#test_debug 'cat $(pwd)/gitweb_config.perl'\n\n# ----------------------------------------------------------------------\n# no commits\n\ntest_expect_success \\\n        'no commits: projects_list (implicit)' \\\n        'gitweb_run'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'no commits: projects_index' \\\n        'gitweb_run \"a=project_index\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'no commits: .git summary (implicit)' \\\n        'gitweb_run \"p=.git\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'no commits: .git commit (implicit)' \\\n        'gitweb_run \"p=.git;a=commit\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'no commits: .git tree (implicit)' \\\n        'gitweb_run \"p=.git;a=tree\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'no commits: .git heads (implicit)' \\\n        'gitweb_run \"p=.git;a=heads\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'no commits: .git tags (implicit)' \\\n        'gitweb_run \"p=.git;a=tags\"'\ntest_debug 'cat gitweb.log'\n\n\n# ----------------------------------------------------------------------\n# initial commit\n\ntest_expect_success \\\n        'make initial commit' \\\n        'echo \"Not an empty file.\" > file &&\n         git add file &&\n         git commit -a -m \"Initial commit.\"'\n\ntest_expect_success \\\n        'projects_list (implicit)' \\\n        'gitweb_run'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'projects_index' \\\n        'gitweb_run \"a=project_index\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git summary (implicit)' \\\n        'gitweb_run \"p=.git\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git commit (implicit)' \\\n        'gitweb_run \"p=.git;a=commit\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git commitdiff (implicit)' \\\n        'gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git commit (HEAD)' \\\n        'gitweb_run \"p=.git;a=commit;h=HEAD\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git commit (..invalid^..)' \\\n        'gitweb_run \"p=.git;a=commit;h=..invalid^..\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git commit (non-existent)' \\\n        'gitweb_run \"p=.git;a=commit;h=non-existent\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git tree (implicit)' \\\n        'gitweb_run \"p=.git;a=tree\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git tree (0000000000000000000000000000000000000000)' \\\n        'gitweb_run \"p=.git;a=tree;h=0000000000000000000000000000000000000000\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git blob (file)' \\\n        'gitweb_run \"p=.git;a=blob;f=file\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git blob_plain (file)' \\\n        'gitweb_run \"p=.git;a=blob_plain;f=file\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        '.git blob (non-existent)' \\\n        'gitweb_run \"p=.git;a=blob;f=non-existent\"'\ntest_debug 'cat gitweb.log'\n\n# ----------------------------------------------------------------------\n# commitdiff testing\n\ntest_expect_success \\\n        'commitdiff: root' \\\n        'gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: file added' \\\n        'echo \"New file\" > new_file &&\n         git add new_file &&\n         git commit -a -m \"File added.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: mode change' \\\n        'chmod a+x new_file &&\n         git commit -a -m \"Mode changed.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: file renamed' \\\n        'git mv new_file renamed_file &&\n         git commit -a -m \"File renamed.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: file to symlink' \\\n        'rm renamed_file &&\n         ln -s file renamed_file &&\n         git commit -a -m \"File to symlink.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: file deleted' \\\n        'git rm renamed_file &&\n         rm -f renamed_file &&\n         git commit -a -m \"File removed.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: file copied / new file' \\\n        'cp file file2 &&\n         git add file2 &&\n         git commit -a -m \"File copied.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: mode change and modified' \\\n        'echo \"New line\" >> file2 &&\n         chmod a+x file2 &&\n         git commit -a -m \"Mode change and modification.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: renamed and modified' \\\n        'cat >file2<<EOF &&\nDominus regit me,\net nihil mihi deerit.\nIn loco pascuae ibi me collocavit,\nsuper aquam refectionis educavit me;\nanimam meam convertit,\ndeduxit me super semitas jusitiae,\npropter nomen suum.\nEOF\n         git commit -a -m \"File added.\" &&\n         git mv file2 file3 &&\n         echo \"Propter nomen suum.\" >> file3 &&\n         git commit -a -m \"File rename and modification.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n        'commitdiff: renamed, mode change and modified' \\\n        'git mv file3 file2 &&\n         echo \"Propter nomen suum.\" >> file2 &&\n         chmod a+x file2 &&\n         git commit -a -m \"File rename, mode change and modification.\" &&\n         gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\n# ----------------------------------------------------------------------\n# tags testing\n\ntest_expect_success \\\n        'tags: different types of tags' \\\n        'git tag -a -m \"Tag commit object\" tag-commit HEAD &&\n         git tag -a -m \"Tag tag object\" tag-tag tag-commit &&\n         git tag -a -m \"Tag tree object\" tag-tree HEAD^{tree} &&\n         git tag -a -m \"Tag blob object\" tag-blob HEAD:file &&\n         git tag lightweight/tag-commit HEAD &&\n         git tag lightweight/tag-tag tag-commit &&\n         git tag lightweight/tag-tree HEAD^{tree} &&\n         git tag lightweight/tag-blob HEAD:file &&\n         gitweb_run \"p=.git;a=tags\"'\ntest_debug 'cat gitweb.log'\n\ntest_done\n"},{"id":"30837","messageId":"7vsleqjz1u.fsf@assigned-by-dhcp.cox.net","threadId":"6213","inReplyTo":"enh9h8$7l0$2@sea.gmane.org","subject":"Re: [PATCH] gitweb: Fix \"Use of uninitialized value\" warning in git_tags_body","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-04T20:51:25Z","receivedAt":"2007-01-04T20:51:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n>> Fix \"Use of uninitialized value\" warning in git_tags_body generated\n>> for lightweight tags of tree and blob object; those don't have age\n>> ($tag{'age'}) defined.\n>\n> By the way, the latest \"Fix warnings\" patches for gitweb were result\n> of working on bare bones test suite for gitweb. For now I'm only\n> checking if there was anything written to STDERR.\n\nI think this is a useful thing to have in-tree at this point,\nwith perhaps minor tweaks I'd suggest later.  That way other\npeople can write more tests to catch regressions.\n\n> BTW how in portable way to check that given file matches given patterns\n> in specified order, or matches given patterns in any order?\n\nThis depends on how different the same page is rendered at\ndifferent times; I suspect the outputs for the same request from\ntwo runs of the test are expected to be different in age, commit\nand tag object ID and nothing else?\n\nIf so, I think using test_tick() to force the stable commit\nobject ID while your test is building a test repository would be\na useful thing to do.  Also I think replacing call to \"time\"\n(you seem to call it from multiple places, all to compute \"age\")\nwith a call to a subroutine \"git_time\" and then defining:\n\n\tsub git_time {\n        \tif (exists $::ENV{GIT_TEST_TIME}) {\n                \treturn $::ENV{GIT_TEST_TIME};\n                }\n                return time;\n        }\n\nto help testing would be sensible.  Set and export GIT_TEST_TIME\nto a fixed time (say, midnight GMT December 28th, 2006) in\ngitweb_init and you will get stable agestring if you have\nalready made the commit and author timestamps stable with\ntest_tick().\n"},{"id":"31004","messageId":"200701070340.01182.jnareb@gmail.com","threadId":"6213","inReplyTo":"7vsleqjz1u.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: Fix \"Use of uninitialized value\" warning in git_tags_body","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-07T02:40:00Z","receivedAt":"2007-01-07T02:40:00Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>>> Fix \"Use of uninitialized value\" warning in git_tags_body generated\n>>> for lightweight tags of tree and blob object; those don't have age\n>>> ($tag{'age'}) defined.\n>>\n>> By the way, the latest \"Fix warnings\" patches for gitweb were result\n>> of working on bare bones test suite for gitweb. For now I'm only\n>> checking if there was anything written to STDERR.\n> \n> I think this is a useful thing to have in-tree at this point,\n> with perhaps minor tweaks I'd suggest later.  That way other\n> people can write more tests to catch regressions.\n\nI plan to submit it soonish... should I submit it early, incomplete,\nor first fix it up a bit?\n\n>> BTW how in portable way to check that given file matches given patterns\n>> in specified order, or matches given patterns in any order?\n> \n> This depends on how different the same page is rendered at\n> different times; I suspect the outputs for the same request from\n> two runs of the test are expected to be different in age, commit\n> and tag object ID and nothing else?\n\nThe problem with test for gitweb is that is fairly easy to test\nfor things that should not change independent of the changes in\noutput, namely:\n * gitweb should not write warnings and errors to web server log,\n   if they result from incorrect parameters (e.g. object not found);\n   simple check if anything is written to STDERR\n * the output should be well-formed XHTML (or XML in the case\n   of OPML, RSS and Atom fields), but this needs externel tools\n   like HTMLtidy\n * HTTP status is well defined, too\n \nWhat is harder to check is that:\n * all the information which should be is there\n\nThe goal is to have test which does not change from pass to fail\nif we replace ' ' by '&nbsp;', make some fragment hyperlink,\nadd something, etc...\n\n> If so, I think using test_tick() to force the stable commit\n> object ID while your test is building a test repository would be\n> a useful thing to do.  Also I think replacing call to \"time\"\n> (you seem to call it from multiple places, all to compute \"age\")\n> with a call to a subroutine \"git_time\" and then defining:\n> \n> \tsub git_time {\n>         \tif (exists $::ENV{GIT_TEST_TIME}) {\n>                 \treturn $::ENV{GIT_TEST_TIME};\n>                 }\n>                 return time;\n>         }\n> \n> to help testing would be sensible.  Set and export GIT_TEST_TIME\n> to a fixed time (say, midnight GMT December 28th, 2006) in\n> gitweb_init and you will get stable agestring if you have\n> already made the commit and author timestamps stable with\n> test_tick().\n\nGood idea, nice to know. Even nicer would be to have it described\nin t/README...\n\n-- \nJakub Narebski\nPoland\n\n\n#!/bin/sh\n#\n# Copyright (c) 2007 Jakub Narebski\n#\n\ntest_description='gitweb as standalone script (basic tests).\n\nThis test runs gitweb (git web interface) as CGI script from\ncommandline, and checks that it does not spew any errors\nor warnings.'\n\ngitweb_init () {\n\tcat >gitweb_config.perl <<EOF\n#!/usr/bin/perl\n\n# gitweb configuration for tests\n\nour \\$version = \"current\";\nour \\$GIT = \"git\";\nour \\$projectroot = \"$(pwd)\";\nour \\$home_link_str = \"projects\";\nour \\$site_name = \"[localhost]\";\nour \\$site_header = \"\";\nour \\$site_footer = \"\";\nour \\$home_text = \"indextext.html\";\nour @stylesheets = (\"file:///$(pwd)/../../gitweb/gitweb.css\");\nour \\$logo = \"file:///$(pwd)/../../gitweb/git-logo.png\";\nour \\$favicon = \"file:///$(pwd)/../../gitweb/git-favicon.png\";\nour \\$projects_list = \"\";\nour \\$export_ok = \"\";\nour \\$strict_export = \"\";\nEOF\n}\n\ngitweb_run () {\n\texport GATEWAY_INTERFACE=\"CGI/1.1\"\n\texport HTTP_ACCEPT=\"*/*\"\n\texport REQUEST_METHOD=\"GET\"\n\texport QUERY_STRING=\"\"$1\"\"\n\texport PATH_INFO=\"\"$2\"\"\n\n\texport GITWEB_CONFIG=$(pwd)/gitweb_config.perl\n\n\trm -f gitweb.log &&\n\tperl -- $(pwd)/../../gitweb/gitweb.perl \\\n\t\t>/dev/null 2>gitweb.log &&\n\ttest ! -s gitweb.log\n}\n\n. ./test-lib.sh\n\ngitweb_init\n\n#test_debug 'cat $(pwd)/gitweb_config.perl'\n\n# ----------------------------------------------------------------------\n# no commits\n\ntest_expect_success \\\n\t'no commits: projects_list (implicit)' \\\n\t'gitweb_run'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'no commits: projects_index' \\\n\t'gitweb_run \"a=project_index\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'no commits: .git summary (implicit)' \\\n\t'gitweb_run \"p=.git\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'no commits: .git commit (implicit)' \\\n\t'gitweb_run \"p=.git;a=commit\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'no commits: .git tree (implicit)' \\\n\t'gitweb_run \"p=.git;a=tree\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'no commits: .git heads (implicit)' \\\n\t'gitweb_run \"p=.git;a=heads\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'no commits: .git tags (implicit)' \\\n\t'gitweb_run \"p=.git;a=tags\"'\ntest_debug 'cat gitweb.log'\n\n\n# ----------------------------------------------------------------------\n# initial commit\n\ntest_expect_success \\\n\t'make initial commit' \\\n\t'echo \"Not an empty file.\" > file &&\n\t git add file &&\n\t git commit -a -m \"Initial commit.\" &&\n\t git branch b'\n\ntest_expect_success \\\n\t'projects_list (implicit)' \\\n\t'gitweb_run'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'projects_index' \\\n\t'gitweb_run \"a=project_index\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git summary (implicit)' \\\n\t'gitweb_run \"p=.git\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git commit (implicit)' \\\n\t'gitweb_run \"p=.git;a=commit\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git commitdiff (implicit)' \\\n\t'gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git commit (HEAD)' \\\n\t'gitweb_run \"p=.git;a=commit;h=HEAD\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git commit (..invalid^..)' \\\n\t'gitweb_run \"p=.git;a=commit;h=..invalid^..\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git tree (implicit)' \\\n\t'gitweb_run \"p=.git;a=tree\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git blob (file)' \\\n\t'gitweb_run \"p=.git;a=blob;f=file\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git blob_plain (file)' \\\n\t'gitweb_run \"p=.git;a=blob_plain;f=file\"'\ntest_debug 'cat gitweb.log'\n\n# ----------------------------------------------------------------------\n# nonexistent objects\n\ntest_expect_success \\\n\t'.git commit (non-existent)' \\\n\t'gitweb_run \"p=.git;a=commit;h=non-existent\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git commitdiff (non-existent)' \\\n\t'gitweb_run \"p=.git;a=commitdiff;h=non-existent\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git tree (0000000000000000000000000000000000000000)' \\\n\t'gitweb_run \"p=.git;a=tree;h=0000000000000000000000000000000000000000\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git blob (non-existent)' \\\n\t'gitweb_run \"p=.git;a=blob;f=non-existent\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'.git blob_plain (non-existent)' \\\n\t'gitweb_run \"p=.git;a=blob_plain;f=non-existent\"'\ntest_debug 'cat gitweb.log'\n\n# ----------------------------------------------------------------------\n# commitdiff testing (implicit, one implicit tree-ish)\n\ntest_expect_success \\\n\t'commitdiff: root' \\\n\t'gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: file added' \\\n\t'echo \"New file\" > new_file &&\n\t git add new_file &&\n\t git commit -a -m \"File added.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: mode change' \\\n\t'chmod a+x new_file &&\n\t git commit -a -m \"Mode changed.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: file renamed' \\\n\t'git mv new_file renamed_file &&\n\t git commit -a -m \"File renamed.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: file to symlink' \\\n\t'rm renamed_file &&\n\t ln -s file renamed_file &&\n\t git commit -a -m \"File to symlink.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: file deleted' \\\n\t'git rm renamed_file &&\n\t rm -f renamed_file &&\n\t git commit -a -m \"File removed.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: file copied / new file' \\\n\t'cp file file2 &&\n\t git add file2 &&\n\t git commit -a -m \"File copied.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: mode change and modified' \\\n\t'echo \"New line\" >> file2 &&\n\t chmod a+x file2 &&\n\t git commit -a -m \"Mode change and modification.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: renamed and modified' \\\n\t'cat >file2<<EOF &&\nDominus regit me,\net nihil mihi deerit.\nIn loco pascuae ibi me collocavit,\nsuper aquam refectionis educavit me;\nanimam meam convertit,\ndeduxit me super semitas jusitiae,\npropter nomen suum.\nEOF\n\t git commit -a -m \"File added.\" &&\n\t git mv file2 file3 &&\n\t echo \"Propter nomen suum.\" >> file3 &&\n\t git commit -a -m \"File rename and modification.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff: renamed, mode change and modified' \\\n\t'git mv file3 file2 &&\n\t echo \"Propter nomen suum.\" >> file2 &&\n\t chmod a+x file2 &&\n\t git commit -a -m \"File rename, mode change and modification.\" &&\n\t gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\n# ----------------------------------------------------------------------\n# commitdiff testing (taken from t4114-apply-typechange.sh)\n\ntest_expect_success 'setup typechange commits' '\n\techo \"hello world\" > foo &&\n\techo \"hi planet\" > bar &&\n\tgit update-index --add foo bar &&\n\tgit commit -m initial &&\n\tgit branch initial &&\n\trm -f foo &&\n\tln -s bar foo &&\n\tgit update-index foo &&\n\tgit commit -m \"foo symlinked to bar\" &&\n\tgit branch foo-symlinked-to-bar &&\n\trm -f foo &&\n\techo \"how far is the sun?\" > foo &&\n\tgit update-index foo &&\n\tgit commit -m \"foo back to file\" &&\n\tgit branch foo-back-to-file &&\n\trm -f foo &&\n\tgit update-index --remove foo &&\n\tmkdir foo &&\n\techo \"if only I knew\" > foo/baz &&\n\tgit update-index --add foo/baz &&\n\tgit commit -m \"foo becomes a directory\" &&\n\tgit branch \"foo-becomes-a-directory\" &&\n\techo \"hello world\" > foo/baz &&\n\tgit update-index foo/baz &&\n\tgit commit -m \"foo/baz is the original foo\" &&\n\tgit branch foo-baz-renamed-from-foo\n\t'\n\ntest_expect_success \\\n\t'commitdiff(2): file renamed from foo to foo/baz' \\\n\t'gitweb_run \"p=.git;a=commitdiff;hp=initial;h=foo-baz-renamed-from-foo\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff(2): file renamed from foo/baz to foo' \\\n\t'gitweb_run \"p=.git;a=commitdiff;hp=foo-baz-renamed-from-foo;h=initial\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff(2): directory becomes file' \\\n\t'gitweb_run \"p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=initial\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff(2): file becomes directory' \\\n\t'gitweb_run \"p=.git;a=commitdiff;hp=initial;h=foo-becomes-a-directory\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff(2): file becomes symlink' \\\n\t'gitweb_run \"p=.git;a=commitdiff;hp=initial;h=foo-symlinked-to-bar\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff(2): symlink becomes file' \\\n\t'gitweb_run \"p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-back-to-file\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff(2): symlink becomes directory' \\\n\t'gitweb_run \"p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-becomes-a-directory\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'commitdiff(2): directory becomes symlink' \\\n\t'gitweb_run \"p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar\"'\ntest_debug 'cat gitweb.log'\n\n# ----------------------------------------------------------------------\n# commitdiff large\ntest_expect_success \\\n\t'create a merge' \\\n\t'git checkout b &&\n\t echo \"Branch\" >> b &&\n\t git add b &&\n\t git commit -a -m \"On branch\" &&\n\t git checkout master &&\n\t git pull . b'\n\ntest_expect_success \\\n\t'commitdiff: merge commit' \\\n\t'gitweb_run \"p=.git;a=commitdiff\"'\ntest_debug 'cat gitweb.log'\n\n# ----------------------------------------------------------------------\n# tags testing\n\ntest_expect_success \\\n\t'tags: different types of tags' \\\n\t'git tag -a -m \"Tag commit object\" tag-commit HEAD &&\n\t git tag -a -m \"\" tag-commit-nomessage HEAD &&\n\t git tag -a -m \"Tag tag object\" tag-tag tag-commit &&\n\t git tag -a -m \"Tag tree object\" tag-tree HEAD^{tree} &&\n\t git tag -a -m \"Tag blob object\" tag-blob HEAD:file &&\n\t git tag lightweight/tag-commit HEAD &&\n\t git tag lightweight/tag-tag tag-commit &&\n\t git tag lightweight/tag-tree HEAD^{tree} &&\n\t git tag lightweight/tag-blob HEAD:file &&\n\t gitweb_run \"p=.git;a=tags\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'tag: Tag to commit object' \\\n\t'gitweb_run \"p=.git;a=tag;h=tag-commit\"'\ntest_debug 'cat gitweb.log'\n\ntest_expect_success \\\n\t'tag: on lightweight tag (invalid)' \\\n\t'gitweb_run \"p=.git;a=tag;h=lightweight/tag-commit\"'\ntest_debug 'cat gitweb.log'\n\ntest_done\n"}]}