Răsfoiți Sursa

List #1061 as having been implemented

Jelmer Vernooij 2 luni în urmă
părinte
comite
74adc293b5
3 a modificat fișierele cu 5 adăugiri și 13 ștergeri
  1. 1 1
      NEWS
  2. 1 9
      dulwich/index.py
  3. 3 3
      tests/compat/test_index.py

+ 1 - 1
NEWS

@@ -5,7 +5,7 @@
    compression (30-50% smaller index files) and optional hash skipping for faster
    writes. Supports ``feature.manyFiles``, ``index.version``, and ``index.skipHash``
    configuration options.
-   (Jelmer Vernooij, #1462)
+   (Jelmer Vernooij, #1061, #1462)
 
  * In dulwich.porcelain docstring, list functions by their Python identifiers.
    (Marnanel Thurman)

+ 1 - 9
dulwich/index.py

@@ -570,11 +570,9 @@ def write_cache_entry(
         # This matches how C Git implements index v4 flags
         compressed_path = _compress_path(entry.name, previous_path)
         flags = len(entry.name) | (entry.flags & ~FLAG_NAMEMASK)
-        use_compression = True
     else:
         # Versions < 4: include actual name length
         flags = len(entry.name) | (entry.flags & ~FLAG_NAMEMASK)
-        use_compression = False
 
     if entry.extended_flags:
         flags |= FLAG_EXTENDED
@@ -629,10 +627,6 @@ def read_index_header(f: BinaryIO) -> tuple[int, int]:
     return version, num_entries
 
 
-
-
-
-
 def write_index_extension(f: BinaryIO, extension: IndexExtension) -> None:
     """Write an index extension.
 
@@ -677,9 +671,7 @@ def read_index_dict_with_version(
         else:
             existing = ret.setdefault(entry.name, ConflictedIndexEntry())
             if isinstance(existing, IndexEntry):
-                raise AssertionError(
-                    f"Non-conflicted entry for {entry.name!r} exists"
-                )
+                raise AssertionError(f"Non-conflicted entry for {entry.name!r} exists")
             if stage == Stage.MERGE_CONFLICT_ANCESTOR:
                 existing.ancestor = IndexEntry.from_serialized(entry)
             elif stage == Stage.MERGE_CONFLICT_THIS:

+ 3 - 3
tests/compat/test_index.py

@@ -469,7 +469,7 @@ class IndexV4CompatTestCase(CompatTestCase):
         run_git_or_fail(["commit", "-m", "master change"], cwd=repo.path)
 
         # Try to merge (should create conflicts)
-        result = run_git_or_fail(["merge", "feature"], cwd=repo.path, check=False)
+        run_git_or_fail(["merge", "feature"], cwd=repo.path, check=False)
 
         # Read the index with conflicts
         index_path = os.path.join(repo.path, ".git", "index")
@@ -512,7 +512,7 @@ class IndexV4CompatTestCase(CompatTestCase):
                 filepath = os.path.join(repo.path, filename)
                 os.makedirs(os.path.dirname(filepath), exist_ok=True)
                 with open(filepath, "w") as f:
-                    f.write(f"Content\n")
+                    f.write("Content\n")
                 valid_files.append(filename)
             except (OSError, ValueError):
                 # Skip files that can't be created on this system
@@ -867,7 +867,7 @@ class IndexV4CompatTestCase(CompatTestCase):
         batch_size = 50
         for i in range(0, len(files), batch_size):
             batch = files[i : i + batch_size]
-            run_git_or_fail(["add"] + batch, cwd=repo.path)
+            run_git_or_fail(["add", *batch], cwd=repo.path)
 
         # Test reading large index
         index_path = os.path.join(repo.path, ".git", "index")