{"thread":{"id":"20424","subject":"[PATCHv5 1/3] gitweb: support to globally disable a snapshot format","startedAt":"2009-08-06T04:24:53Z","lastAt":"2009-08-06T06:20:56Z","messageCount":2,"participants":["Mark A Rada","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"119742","messageId":"35210404-7E4C-4CB9-881C-45C9E61ACECE@uwaterloo.ca","threadId":"20424","inReplyTo":null,"subject":"[PATCHv5 1/3] gitweb: support to globally disable a snapshot format","fromName":"Mark A Rada","fromEmail":"marada@uwaterloo.ca","sentAt":"2009-08-06T04:24:53Z","receivedAt":"2009-08-06T04:24:53Z","isPatch":false,"sender":{"key":"marada@uwaterloo.ca","avatar":"https://avatars.githubusercontent.com/u/38430?v=4"},"body":"Re-ordered, as suggested by Junio.\n\n--\nMark A Rada (ferrous26)\nmarada@uwaterloo.ca\n\n\n--->8---\nFrom: Mark Rada <marada@uwaterloo.ca>\nDate: Wed, 5 Aug 2009 21:02:54 -0400\nSubject: [PATCH 1/3] gitweb: support to globally disable a snapshot  \nformat\n\nI added an optional variable, 'disabled', to to the\n$known_snapshot_formats keys so that a Gitweb administrator can\nglobally enable or disable a specific format for snapshots.\n\nAll formats are enabled by default because project specific overriding\nis disabled by default.\n\nSigned-off-by: Mark Rada <marada@uwaterloo.ca>\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 37120a3..a0cdf31 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -160,7 +160,8 @@ our %known_snapshot_formats = (\n  \t# \t'suffix' => filename suffix,\n  \t# \t'format' => --format for git-archive,\n  \t# \t'compressor' => [compressor command and arguments]\n-\t# \t                (array reference, optional)}\n+\t# \t                (array reference, optional)\n+\t# \t'disabled' => boolean (optional)}\n  \t#\n  \t'tgz' => {\n  \t\t'display' => 'tar.gz',\n@@ -494,7 +495,8 @@ sub filter_snapshot_fmts {\n  \t\texists $known_snapshot_format_aliases{$_} ?\n  \t\t       $known_snapshot_format_aliases{$_} : $_} @fmts;\n  \t@fmts = grep {\n-\t\texists $known_snapshot_formats{$_} } @fmts;\n+\t\texists $known_snapshot_formats{$_} &&\n+\t\t!$known_snapshot_formats{$_}{'disabled'}} @fmts;\n  }\n\n  our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || \"++GITWEB_CONFIG++\";\n@@ -5166,6 +5168,8 @@ sub git_snapshot {\n  \t\tdie_error(400, \"Unknown snapshot format\");\n  \t} elsif (!grep($_ eq $format, @snapshot_fmts)) {\n  \t\tdie_error(403, \"Unsupported snapshot format\");\n+\t} elsif ($known_snapshot_formats{$format}{'disabled'}) {\n+\t\tdie_error(403, \"Snapshot format not allowed\");\n  \t}\n\n  \tif (!defined $hash) {\n-- \n1.6.4\n"},{"id":"119753","messageId":"7vtz0lpinr.fsf@alter.siamese.dyndns.org","threadId":"20424","inReplyTo":"35210404-7E4C-4CB9-881C-45C9E61ACECE@uwaterloo.ca","subject":"Re: [PATCHv5 1/3] gitweb: support to globally disable a snapshot format","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-06T06:20:56Z","receivedAt":"2009-08-06T06:20:56Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mark A Rada <marada@uwaterloo.ca> writes:\n\n> Re-ordered, as suggested by Junio.\n>\n> --\n> Mark A Rada (ferrous26)\n> marada@uwaterloo.ca\n>\n>\n> --->8---\n\nPlease have all of the above after the \"---\" line.\n\n> From: Mark Rada <marada@uwaterloo.ca>\n> Date: Wed, 5 Aug 2009 21:02:54 -0400\n> Subject: [PATCH 1/3] gitweb: support to globally disable a snapshot\n> format\n\nAnd you do not need these four lines, as they match what you have in the\ne-mail header.\n\n> I added an optional variable, 'disabled', to to the\n> $known_snapshot_formats keys so that a Gitweb administrator can\n> globally enable or disable a specific format for snapshots.\n\n\"to to\"?\n\nWe tend not to say \"I did this and that\" in our log messsages; order the\ncodebase to do certain new things, or order the maintainer to change the\ncode to make it do new things. e.g.\n\n\tAllow gitweb administrators to set in %known_snapshot_formats hash\n\tan optional key, 'disabled' for specific format.  This can be used\n\tto configure out individual formats.\n\n> All formats are enabled by default because project specific overriding\n> is disabled by default.\n\nThat is not quite a good justification; but \"all the formats have been\nenabled so far, and installing an updated gitweb should not change the\nexisting behaviour\" is.\n"}]}