Browse Source

Fix test suite when run on systems without ~/.gitconfig.

Jelmer Vernooij 11 years ago
parent
commit
2aea50d34c
2 changed files with 9 additions and 11 deletions
  1. 5 2
      dulwich/porcelain.py
  2. 4 9
      dulwich/tests/test_porcelain.py

+ 5 - 2
dulwich/porcelain.py

@@ -107,14 +107,17 @@ def commit(repo=".", message=None, author=None, committer=None):
         committer=committer)
 
 
-def commit_tree(repo, tree, message=None):
+def commit_tree(repo, tree, message=None, author=None, committer=None):
     """Create a new commit object.
 
     :param repo: Path to repository
     :param tree: An existing tree object
+    :param author: Optional author name and email
+    :param committer: Optional committer name and email
     """
     r = open_repo(repo)
-    return r.do_commit(message=message, tree=tree)
+    return r.do_commit(message=message, tree=tree, committer=committer,
+            author=author)
 
 
 def init(path=".", bare=False):

+ 4 - 9
dulwich/tests/test_porcelain.py

@@ -76,14 +76,6 @@ class UpdateServerInfoTests(PorcelainTestCase):
 
 class CommitTests(PorcelainTestCase):
 
-    def test_simple(self):
-        c1, c2, c3 = build_commit_graph(self.repo.object_store, [[1], [2, 1],
-            [3, 1, 2]])
-        self.repo.refs["refs/heads/foo"] = c3.id
-        sha = porcelain.commit(self.repo.path, message="Some message")
-        self.assertTrue(type(sha) is str)
-        self.assertEquals(len(sha), 40)
-
     def test_custom_author(self):
         c1, c2, c3 = build_commit_graph(self.repo.object_store, [[1], [2, 1],
             [3, 1, 2]])
@@ -229,6 +221,9 @@ class CommitTreeTests(PorcelainTestCase):
         t.add("somename", 0100644, b.id)
         self.repo.object_store.add_object(t)
         self.repo.object_store.add_object(b)
-        sha = porcelain.commit_tree(self.repo.path, t.id, message="Withcommit.")
+        sha = porcelain.commit_tree(
+            self.repo.path, t.id, message="Withcommit.",
+            author="Joe <joe@example.com>",
+            committer="Jane <jane@example.com>")
         self.assertTrue(type(sha) is str)
         self.assertEquals(len(sha), 40)