changeset 7360:03afcfc0d17f

middleware: clean-up of Git _git_stored_op This seems to do the same in a simpler way. It is unclear what _git_first_op did. But no matter if it is a typo or something else, it is unused.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 08 Aug 2018 02:23:11 +0200
parents 0ebcc88f1280
children 2b07e757a85f
files kallithea/lib/middleware/simplegit.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/middleware/simplegit.py	Wed Aug 08 02:23:11 2018 +0200
+++ b/kallithea/lib/middleware/simplegit.py	Wed Aug 08 02:23:11 2018 +0200
@@ -63,12 +63,13 @@
 
 class SimpleGit(BaseVCSController):
 
+    _git_stored_op = 'pull' # most recent kind of command
+
     def _handle_request(self, environ, start_response):
         if not is_git(environ):
             return self.application(environ, start_response)
 
         ip_addr = self._get_ip_addr(environ)
-        self._git_first_op = False
         # skip passing error to error controller
         environ['pylons.status_code_redirect'] = True
 
@@ -194,12 +195,9 @@
             }
             op = mapping[service_cmd]
             self._git_stored_op = op
-            return op
-        else:
             # try to fallback to stored variable as we don't know if the last
             # operation is pull/push
-            op = getattr(self, '_git_stored_op', 'pull')
-        return op
+        return self._git_stored_op
 
     def _handle_githooks(self, repo_name, action, baseui, environ):
         """