jelmer / dulwich

Pure-Python Git implementation
https://www.dulwich.io/
Other
2.05k stars 392 forks source link

Using local on-disk repository fails, i.e. non-http(s) URLs #1339

Closed thefriendlynet closed 3 months ago

thefriendlynet commented 3 months ago

LocalGitClient.__init__() got an unexpected keyword argument 'quiet'") After "fixing" that issue an Exception is raised because depth is not yet implemented.

Quick & dirty fix below. Doesn't feel like to right direction to solve the issue. Again, any ideas would be much appreciated.

--- a/dulwich/client.py 
+++ b/dulwich/client.py 
@@ -1407,7 +1407,7 @@
     """Git Client that just uses a local on-disk repository."""

     def __init__(
-        self, thin_packs=True, report_activity=None, config: Optional[Config] = None
+        self, thin_packs=True, report_activity=None, config: Optional[Config] = None, **kwargs
     ) -> None:
         """Create a new LocalGitClient instance.
--- a/repo.py 
+++ b/repo.py
@@ -515,6 +515,7 @@
         progress,
         get_tagged=None,
         depth=None,
+        nonzero_depth_fatal=False
     ) -> Optional[MissingObjectFinder]:
         """Fetch the missing objects required for a set of revisions.

@@ -532,7 +533,8 @@
         Returns: iterator over objects, with __len__ implemented
         """
         if depth not in (None, 0):
-            raise NotImplementedError("depth not supported yet")
+            if nonzero_depth_fatal:
+                raise NotImplementedError("depth not supported yet")

         refs = serialize_refs(self.object_store, self.get_refs())
jelmer commented 3 months ago

quiet is not supported for LocalGitClient, so any particular reason you're passing it in?

Similarly, rather than disabling the exception, any reason you're not just passing in depth=None?

thefriendlynet commented 3 months ago

I got the error while using a Netbox git datasource. Commenting out "quiet" and sending depth=None in their code still produced the exception. If you're sure that LocalGitClient works, I'll try digging deeper to see why quiet and depth still end up in the dulwich code path

jelmer commented 3 months ago

If you can share a backtrack of what happens when you remove the quiet argument in their code that would help.

thefriendlynet commented 3 months ago

Never mind, sorry for wasting your time, I made changes to the Netbox code, but didn't restart the right process (worker vs main netbox code), that's why quiet and depth kept being used. Duh