{"thread":{"id":"5158","subject":"[RFC] gitweb test script","startedAt":"2006-08-06T16:51:51Z","lastAt":"2006-08-07T08:31:38Z","messageCount":3,"participants":["Matthias Lederhofer","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"24896","messageId":"20060806165151.GB9548@moooo.ath.cx","threadId":"5158","inReplyTo":null,"subject":"[RFC] gitweb test script","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-08-06T16:51:51Z","receivedAt":"2006-08-06T16:51:51Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Perhaps this script has a place in the git repository.  Creating some automated\ntests at least checking for warnings should be easy too.  This should work from\nthe git repository and makes gitweb use .git as repository.  At the moment it\nstill needs the git binary to be in the path already to find the top repository\ndirectory.\n\nThis could also be extended for automated tests.  Here is an example how this\ncould look like (currently this does not test much of gitweb):\n\n#!/bin/sh\ndie() {\n\techo \"$0: $*\" >&2\n\texit 1\n}\n\ncleanup() {\n\t[ -e \"$TMP\" ] && rm \"$TMP\"\n}\n\ntest() {\n\techo \"test: $@\"\n\t\"$gitweb\" \"$@\" > /dev/null 2> \"$TMP\"\n\tif [ ! -s \"$TMP\" ]; then\n\t\treturn\n\tfi\n\techo \"========== ERRORS ==========\"\n\tcat \"$TMP\"\n\techo \"============================\"\n}\n\ngitweb=\"./`git rev-parse --show-cdup`/t/gitweb.sh\"\nTMP=\"\"\ntrap cleanup EXIT\nTMP=\"`mktemp`\" || die mktemp failed\n\n# repository overview\ntest\n# summary\ntest p=.git\n\n# commitdiff\n\n# initial commit\ntest p=.git a=commitdiff \\\n\th=e83c5163316f89bfbde7d9ab23ca2e25604af290\n# some other commit\ntest p=.git a=commitdiff \\\n\th=5a716826a6f7f209777f344143cdd9e4f2903097\n# merge commit withouth specified parent\ntest p=.git a=commitdiff \\\n\th=e190bc55431d906b8c70dc07f8b6d823721f12c9\n# merge commit with specified parent\ntest p=.git a=commitdiff \\\n\th=e190bc55431d906b8c70dc07f8b6d823721f12c9 \\\n\thp=360204c324ca9178e2bcb4d75f3986201f8ac7e1\n---\n t/gitweb.sh          |   29 +++++++++++++++++++++++++++++\n t/gitweb_config.perl |    4 ++++\n 2 files changed, 33 insertions(+), 0 deletions(-)\n\ndiff --git a/t/gitweb.sh b/t/gitweb.sh\nnew file mode 100755\nindex 0000000..b0dff26\n--- /dev/null\n+++ b/t/gitweb.sh\n@@ -0,0 +1,29 @@\n+#!/bin/sh\n+# this script runs gitweb.perl from the shell having .git as repository\n+# command line parameters are used as query string\n+\n+TOPDIR=\"`pwd``git rev-parse --show-cdup`\"\n+if [ ! -e \"$TOPDIR/git\" ]; then\n+\techo \"$0: You haven't built things yet, have you?\" >&2\n+\texit 1\n+fi\n+\n+export PATH=\"$TOPDIR:$PATH\"\n+export GIT_EXEC_PATH=\"$TOPDIR\"\n+\n+# cgi environment\n+export GATEWAY_INTERFACE=CGI/1.1\n+export REQUEST_METHOD=GET\n+QUERY_STRING=\"\"\n+if [ $# -gt 0 ]; then\n+\tQUERY_STRING=\"$1\"\n+\tshift\n+fi\n+while [ $# -gt 0 ]; do\n+\tQUERY_STRING=\"$QUERY_STRING;$1\"\n+\tshift\n+done\n+export QUERY_STRING\n+\n+export GITWEB_CONFIG=\"$TOPDIR/t/gitweb_config.perl\"\n+exec \"$TOPDIR/gitweb/gitweb.perl\"\ndiff --git a/t/gitweb_config.perl b/t/gitweb_config.perl\nnew file mode 100644\nindex 0000000..5c245ff\n--- /dev/null\n+++ b/t/gitweb_config.perl\n@@ -0,0 +1,4 @@\n+$projectroot = \"./\".qx(git rev-parse --show-cdup);\n+chomp($projectroot);\n+$projects_list = $projectroot;\n+$GIT = $projectroot.'/git';\n-- \n1.4.1.gfd699\n"},{"id":"24903","messageId":"7vac6h8rzo.fsf@assigned-by-dhcp.cox.net","threadId":"5158","inReplyTo":"20060806165151.GB9548@moooo.ath.cx","subject":"Re: [RFC] gitweb test script","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-06T21:38:19Z","receivedAt":"2006-08-06T21:38:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthias Lederhofer <matled@gmx.net> writes:\n\n> Perhaps this script has a place in the git repository.\n> Creating some automated tests at least checking for warnings\n> should be easy too.  This should work from the git repository\n> and makes gitweb use .git as repository.  At the moment it\n> still needs the git binary to be in the path already to find\n> the top repository directory.\n\nA good start.  We really need something like this.\n"},{"id":"24912","messageId":"20060807083138.GA7442@moooo.ath.cx","threadId":"5158","inReplyTo":"20060806165151.GB9548@moooo.ath.cx","subject":"Re: [RFC] gitweb test script","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-08-07T08:31:38Z","receivedAt":"2006-08-07T08:31:38Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Matthias Lederhofer <matled@gmx.net> wrote:\n> +TOPDIR=\"`pwd``git rev-parse --show-cdup`\"\n\nThis should be\nTOPDIR=\"`pwd`/`git rev-parse --show-cdup`\"\n"}]}