Commit Diff


commit - 654766c3806211c638a82415ea4cbfcc65b39129
commit + 1562c4e3fcaba7ada857773ff2f7cd4282062632
blob - 36428875ccb435950e8879e3f922ac4ecf2e3f16
blob + a1d37c0f96ce73b10dd47fda9e180499afedb4ee
--- dulwich/tests/test_porcelain.py
+++ dulwich/tests/test_porcelain.py
@@ -2813,3 +2813,15 @@ class WriteTreeTests(PorcelainTestCase):
 class ActiveBranchTests(PorcelainTestCase):
     def test_simple(self):
         self.assertEqual(b"master", porcelain.active_branch(self.repo))
+
+
+class FindUniqueAbbrevTests(PorcelainTestCase):
+
+    def test_simple(self):
+        c1, c2, c3 = build_commit_graph(
+            self.repo.object_store, [[1], [2, 1], [3, 1, 2]]
+        )
+        self.repo.refs[b"HEAD"] = c3.id
+        self.assertEqual(
+            c1.id.decode('ascii')[:7],
+            porcelain.find_unique_abbrev(self.repo.object_store, c1.id))