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.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/morphlib/gitindex_tests.py b/morphlib/gitindex_tests.py
index af0e0444..94444091 100644
--- a/morphlib/gitindex_tests.py
+++ b/morphlib/gitindex_tests.py
@@ -73,3 +73,15 @@ class GitIndexTests(unittest.TestCase):
idx.add_files_from_index_info(
[(os.stat(filepath).st_mode, sha1, 'foo')])
self.assertEqual(list(idx.get_uncommitted_changes()),[])
+
+ def test_add_files_from_working_tree(self):
+ gd = morphlib.gitdir.GitDirectory(self.dirname)
+ idx = gd.get_index()
+ idx.add_files_from_working_tree(['foo'])
+ self.assertEqual(list(idx.get_uncommitted_changes()),[])
+
+ def test_add_files_from_working_tree_fails_in_bare(self):
+ gd = morphlib.gitdir.GitDirectory(self.mirror)
+ idx = gd.get_index()
+ self.assertRaises(morphlib.gitdir.NoWorkingTreeError,
+ idx.add_files_from_working_tree, ['foo'])