Преглед изворни кода

Fix filename for MERGE_HEAD.

Jelmer Vernooij пре 4 година
родитељ
комит
c60b83b30b
3 измењених фајлова са 7 додато и 4 уклоњено
  1. 3 0
      NEWS
  2. 3 3
      dulwich/repo.py
  3. 1 1
      dulwich/tests/test_repository.py

+ 3 - 0
NEWS

@@ -3,6 +3,9 @@
  * Prevent removal of refs directory when the last ref is
    deleted. (Jelmer Vernooij)
 
+ * Fix filename: MERGE_HEADS => MERGE_HEAD.
+   (Jelmer Vernooij, #861)
+
 0.20.21	2021-03-20
 
  * Add basic support for a GcsObjectStore that stores

+ 3 - 3
dulwich/repo.py

@@ -883,7 +883,7 @@ class BaseRepo(object):
             current index will be committed).
           encoding: Encoding
           ref: Optional ref to commit to (defaults to current branch)
-          merge_heads: Merge heads (defaults to .git/MERGE_HEADS)
+          merge_heads: Merge heads (defaults to .git/MERGE_HEAD)
           no_verify: Skip pre-commit and commit-msg hooks
 
         Returns:
@@ -909,7 +909,7 @@ class BaseRepo(object):
 
         config = self.get_config_stack()
         if merge_heads is None:
-            merge_heads = self._read_heads("MERGE_HEADS")
+            merge_heads = self._read_heads("MERGE_HEAD")
         if committer is None:
             committer = get_user_identity(config, kind="COMMITTER")
         check_user_identity(committer)
@@ -990,7 +990,7 @@ class BaseRepo(object):
                 # commit and all its objects as garbage.
                 raise CommitError("%s changed during commit" % (ref,))
 
-        self._del_named_file("MERGE_HEADS")
+        self._del_named_file("MERGE_HEAD")
 
         try:
             self.hooks["post-commit"].execute()

+ 1 - 1
dulwich/tests/test_repository.py

@@ -892,7 +892,7 @@ class BuildRepoRootTests(TestCase):
         )
         with open(os.path.join(r.path, "a"), "w") as f:
             f.write("merged text")
-        with open(os.path.join(r.path, ".git", "MERGE_HEADS"), "w") as f:
+        with open(os.path.join(r.path, ".git", "MERGE_HEAD"), "w") as f:
             f.write("c27a2d21dd136312d7fa9e8baabb82561a1727d0\n")
         r.stage(["a"])
         commit_sha = r.do_commit(