Explorar el Código

dumb: Optimize number of HTTP requests sent to git server

In practice, it is better to check objects existence in pack files
first to avoid flooding git server with numerous HTTP requests.
Antoine Lambert hace 1 mes
padre
commit
6f2d83a73b
Se han modificado 1 ficheros con 8 adiciones y 8 borrados
  1. 8 8
      dulwich/dumb.py

+ 8 - 8
dulwich/dumb.py

@@ -258,16 +258,16 @@ class DumbHTTPObjectStore(BaseObjectStore):
         if sha in self._cached_objects:
             return self._cached_objects[sha]
 
-        # Try loose object first
+        # Try packs first
         try:
-            result = self._fetch_loose_object(sha)
+            result = self._fetch_from_pack(sha)
             self._cached_objects[sha] = result
             return result
         except KeyError:
             pass
 
-        # Try packs
-        result = self._fetch_from_pack(sha)
+        # Try loose object
+        result = self._fetch_loose_object(sha)
         self._cached_objects[sha] = result
         return result
 
@@ -284,16 +284,16 @@ class DumbHTTPObjectStore(BaseObjectStore):
         if sha in self._cached_objects:
             return True
 
-        # Try loose object
+        # Try packs
         try:
-            self._fetch_loose_object(sha)
+            self._fetch_from_pack(sha)
             return True
         except KeyError:
             pass
 
-        # Try packs
+        # Try loose object
         try:
-            self._fetch_from_pack(sha)
+            self._fetch_loose_object(sha)
             return True
         except KeyError:
             return False