summaryrefslogtreecommitdiff
path: root/morphlib/gitindex_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-11-11 17:59:36 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-11-22 13:49:26 +0000
commita070b772a565a2803bb1ac4c63a1784cb249ecc3 (patch)
tree0d30ae7b088573d4b95e5a96ba30f5a7233c2b92 /morphlib/gitindex_tests.py
parent02f112af84b32b6731b6d286d3002730bfb2eabc (diff)
downloadmorph-a070b772a565a2803bb1ac4c63a1784cb249ecc3.tar.gz
gitindex: Add GitIndex.write_tree()
This generates a tree object from the index. This can then be used to create a commit.
Diffstat (limited to 'morphlib/gitindex_tests.py')
-rw-r--r--morphlib/gitindex_tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/morphlib/gitindex_tests.py b/morphlib/gitindex_tests.py
index 94444091..7a8953f2 100644
--- a/morphlib/gitindex_tests.py
+++ b/morphlib/gitindex_tests.py
@@ -85,3 +85,8 @@ class GitIndexTests(unittest.TestCase):
idx = gd.get_index()
self.assertRaises(morphlib.gitdir.NoWorkingTreeError,
idx.add_files_from_working_tree, ['foo'])
+
+ def test_write_tree(self):
+ gd = morphlib.gitdir.GitDirectory(self.dirname)
+ idx = gd.get_index()
+ self.assertEqual(idx.write_tree(), gd.resolve_ref_to_tree(gd.HEAD))