{"thread":{"id":"5751","subject":"[PATCH] gitweb: Factor out gitweb_have_snapshot()","startedAt":"2006-09-28T23:49:21Z","lastAt":"2006-09-28T23:49:21Z","messageCount":1,"participants":["Luben Tuikov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27954","messageId":"20060928234921.62443.qmail@web31808.mail.mud.yahoo.com","threadId":"5751","inReplyTo":null,"subject":"[PATCH] gitweb: Factor out gitweb_have_snapshot()","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-28T23:49:21Z","receivedAt":"2006-09-28T23:49:21Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"Create gitweb_have_snapshot() which returns true\nof snapshot is available and enabled, else false.\n\nSigned-off-by: Luben Tuikov <ltuikov@yahoo.com>\n---\n gitweb/gitweb.perl |   14 +++++++++-----\n 1 files changed, 9 insertions(+), 5 deletions(-)\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex f3f22c2..a2f07cc 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -155,6 +155,13 @@ sub feature_snapshot {\n \treturn ($ctype, $suffix, $command);\n }\n \n+sub gitweb_have_snapshot {\n+\tmy ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');\n+\tmy $have_snapshot = (defined $ctype && defined $suffix);\n+\n+\treturn $have_snapshot;\n+}\n+\n # To enable system wide have in $GITWEB_CONFIG\n # $feature{'pickaxe'}{'default'} = [1];\n # To have project specific config enable override in $GITWEB_CONFIG\n@@ -2736,8 +2743,7 @@ sub git_blob {\n }\n \n sub git_tree {\n-\tmy ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');\n-\tmy $have_snapshot = (defined $ctype && defined $suffix);\n+\tmy $have_snapshot = gitweb_have_snapshot();\n \n \tif (!defined $hash_base) {\n \t\t$hash_base = \"HEAD\";\n@@ -2813,7 +2819,6 @@ sub git_tree {\n }\n \n sub git_snapshot {\n-\n \tmy ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');\n \tmy $have_snapshot = (defined $ctype && defined $suffix);\n \tif (!$have_snapshot) {\n@@ -2923,8 +2928,7 @@ sub git_commit {\n \tmy $refs = git_get_references();\n \tmy $ref = format_ref_marker($refs, $co{'id'});\n \n-\tmy ($ctype, $suffix, $command) = gitweb_check_feature('snapshot');\n-\tmy $have_snapshot = (defined $ctype && defined $suffix);\n+\tmy $have_snapshot = gitweb_have_snapshot();\n \n \tmy @views_nav = ();\n \tif (defined $file_name && defined $co{'parent'}) {\n-- \n1.4.2.1.g05f0f\n\n"}]}