summaryrefslogtreecommitdiff
path: root/morphlib/gitindex_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/gitindex_tests.py')
-rw-r--r--morphlib/gitindex_tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/morphlib/gitindex_tests.py b/morphlib/gitindex_tests.py
index 2dcb5003..af0e0444 100644
--- a/morphlib/gitindex_tests.py
+++ b/morphlib/gitindex_tests.py
@@ -63,3 +63,13 @@ class GitIndexTests(unittest.TestCase):
# by status
idx.set_to_tree(gd.HEAD)
self.assertEqual(list(idx.get_uncommitted_changes()),[])
+
+ def test_add_files_from_index_info(self):
+ gd = morphlib.gitdir.GitDirectory(self.dirname)
+ idx = gd.get_index(os.path.join(self.tempdir, 'index'))
+ filepath = os.path.join(gd.dirname, 'foo')
+ with open(filepath, 'r') as f:
+ sha1 = gd.store_blob(f)
+ idx.add_files_from_index_info(
+ [(os.stat(filepath).st_mode, sha1, 'foo')])
+ self.assertEqual(list(idx.get_uncommitted_changes()),[])