Add support for git-upload-archive
authorSteve McIntyre <smcintyre@aminocom.com>
Mon, 23 Nov 2009 14:33:30 +0000 (14:33 +0000)
committerSteve McIntyre <smcintyre@aminocom.com>
Mon, 23 Nov 2009 14:33:30 +0000 (14:33 +0000)
Add support for git-upload-archive for remote archive creation.
Depends on newer git (we're using git 1.6.5 on the server now).

debian/changelog
gitosis/serve.py

index 84a6851..6fc6367 100644 (file)
@@ -1,3 +1,10 @@
+gitosis (0.2+20091020-amino3) unstable; urgency=low
+
+  * Add support for git-upload-archive for remote archive creation.
+    Depends on newer git (we're using git 1.6.5 on the server now).
+
+ -- Steve McIntyre <smcintyre@aminocom.com>  Mon, 23 Nov 2009 14:32:20 +0100
+
 gitosis (0.2+20091020-amino2) unstable; urgency=low
 
   * Fix the flush/sync code.
 gitosis (0.2+20091020-amino2) unstable; urgency=low
 
   * Fix the flush/sync code.
index 7e590b5..ce3fb6e 100644 (file)
@@ -22,6 +22,8 @@ ALLOW_RE = re.compile("^'/*(?P<path>[a-zA-Z0-9][a-zA-Z0-9@._-]*(/[a-zA-Z0-9][a-z
 COMMANDS_READONLY = [
     'git-upload-pack',
     'git upload-pack',
 COMMANDS_READONLY = [
     'git-upload-pack',
     'git upload-pack',
+    'git-upload-archive',
+    'git upload-archive',
     ]
 
 COMMANDS_WRITE = [
     ]
 
 COMMANDS_WRITE = [
@@ -41,6 +43,9 @@ class CommandMayNotContainNewlineError(ServingError):
 class UnknownCommandError(ServingError):
     """Unknown command denied"""
 
 class UnknownCommandError(ServingError):
     """Unknown command denied"""
 
+class CommandTooLongError(ServingError):
+    """Command malformed - too many args"""
+
 class UnsafeArgumentsError(ServingError):
     """Arguments to command look dangerous"""
 
 class UnsafeArgumentsError(ServingError):
     """Arguments to command look dangerous"""
 
@@ -66,7 +71,7 @@ def serve(
     except ValueError:
         # all known "git-foo" commands take one argument; improve
         # if/when needed
     except ValueError:
         # all known "git-foo" commands take one argument; improve
         # if/when needed
-        raise UnknownCommandError()
+        raise CommandTooLongError()
 
     if verb == 'git':
         try:
 
     if verb == 'git':
         try:
@@ -74,7 +79,7 @@ def serve(
         except ValueError:
             # all known "git foo" commands take one argument; improve
             # if/when needed
         except ValueError:
             # all known "git foo" commands take one argument; improve
             # if/when needed
-            raise UnknownCommandError()
+            raise CommandTooLongError()
         verb = '%s %s' % (verb, subverb)
 
     if (verb not in COMMANDS_WRITE
         verb = '%s %s' % (verb, subverb)
 
     if (verb not in COMMANDS_WRITE