git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Mark A Rada <marada@uwaterloo.ca>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: What's cooking in git.git (Aug 2009, #03; Thu, 20)
Date: Fri, 21 Aug 2009 08:40:34 -0400	[thread overview]
Message-ID: <F4C7A2F3-B030-449A-87AC-B54CA2B647B4@mailservices.uwaterloo.ca> (raw)
In-Reply-To: <7veir5naq3.fsf@alter.siamese.dyndns.org>


On 20-Aug-09, at 10:48 PM, Junio C Hamano wrote:

> Should graduate to 'master' soon.
>
> * mr/gitweb-xz (2009-08-06) 3 commits
>  (merged to 'next' on 2009-08-14 at b63b8e6)
> + gitweb: add support for XZ compressed snapshots
> + gitweb: update INSTALL regarding specific snapshot settings
> + gitweb: support to globally disable a snapshot format
>


I never submitted any tests for the patch that adds global snapshot  
disabling
functionality to gitweb.

Jakub, I changed the gitweb_run routine to capture STDOUT as well, is  
that ok?

Unless I missed a case, the tests show that the extra condition check  
that was
added in the &git_snapshot routine is never actually executed, because a
disabled snapshot format is not added to @snapshot_fmts, which is  
checked
first.

snippet:
5178     } elsif (!grep($_ eq $format, @snapshot_fmts)) {
5179         die_error(403, "Unsupported snapshot format");
5180     } elsif ($known_snapshot_formats{$format}{'disabled'}) {
5181         die_error(403, "Snapshot format not allowed");
5182     }
5183


--
Mark A Rada (ferrous26)
marada@uwaterloo.ca


---
  t/t9500-gitweb-standalone-no-errors.sh |   67 +++++++++++++++++++++++ 
++++++++-
  1 files changed, 66 insertions(+), 1 deletions(-)

diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb- 
standalone-no-errors.sh
index 6275181..9ce9667 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -57,10 +57,11 @@ gitweb_run () {
  	# we are interested only in properly formatted errors/warnings
  	rm -f gitweb.log &&
  	perl -- "$SCRIPT_NAME" \
-		>/dev/null 2>gitweb.log &&
+		>gitweb.output 2>gitweb.log &&
  	if grep "^[[]" gitweb.log >/dev/null 2>&1; then false; else true; fi

  	# gitweb.log is left for debugging
+	# gitweb.output is used to parse output
  }

  . ./test-lib.sh
@@ -704,4 +705,68 @@ test_expect_success \
  	 gitweb_run "p=.git;a=summary"'
  test_debug 'cat gitweb.log'

+
+#  
----------------------------------------------------------------------
+# snapshot settings
+
+cat >>gitweb_config.perl <<EOF
+
+\$feature{'snapshot'}{'override'} = 0;
+EOF
+
+test_expect_success \
+	'snapshots: tgz only default format enabled' \
+	'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+	grep "Status: 200 OK" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&
+	grep "403 - Unsupported snapshot format" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&
+	grep "403 - Unsupported snapshot format" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+	grep "403 - Unsupported snapshot format" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<EOF
+
+\$feature{'snapshot'}{'default'} = ['tgz','tbz2','txz','zip'];
+EOF
+
+test_expect_success \
+	'snapshots: all enabled in default, use default disabled value' \
+	'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+	grep "Status: 200 OK" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&
+	grep "Status: 200 OK" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&
+	grep "403 - Unsupported snapshot format" gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+	grep "Status: 200 OK" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<EOF
+
+\$known_snapshot_formats{'zip'}{'disabled'} = 1;
+EOF
+
+test_expect_success \
+	'snapshots: zip explicitly disabled' \
+	'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&
+	grep "403 - Unsupported snapshot format" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
+cat >>gitweb_config.perl <<EOF
+
+\$known_snapshot_formats{'tgz'}{'disabled'} = 0;
+EOF
+
+test_expect_success \
+	'snapshots: tgz explicitly enabled' \
+	'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&
+	grep "Status: 200 OK" gitweb.output'
+test_debug 'cat gitweb.output'
+
+
  test_done
-- 
1.6.4

  parent reply	other threads:[~2009-08-21 12:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21  2:48 What's cooking in git.git (Aug 2009, #03; Thu, 20) Junio C Hamano
2009-08-21  9:10 ` Paolo Bonzini
2009-08-21 19:36   ` Junio C Hamano
2009-08-21 12:40 ` Mark A Rada [this message]
2009-08-21 18:06   ` Jakub Narebski
2009-08-21 20:10     ` Junio C Hamano
2009-08-22 22:42       ` [RFC] gitweb.perl t9500 t9501 Mark A Rada
2009-08-23  2:09         ` Junio C Hamano
2009-08-23 15:29           ` Mark A Rada
2009-08-21 21:43   ` What's cooking in git.git (Aug 2009, #03; Thu, 20) Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F4C7A2F3-B030-449A-87AC-B54CA2B647B4@mailservices.uwaterloo.ca \
    --to=marada@uwaterloo.ca \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).