diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-11-11 17:55:08 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-11-22 13:49:25 +0000 |
commit | 05cf106943ce737392d507ab1e34a3487849bd9f (patch) | |
tree | 270aa1aea5fdef947aed68474bf1cc565f4ba576 /morphlib/gitindex_tests.py | |
parent | 65fc7474c12b7b0fccd57810ba4f06d2fbca895a (diff) | |
download | morph-05cf106943ce737392d507ab1e34a3487849bd9f.tar.gz |
gitindex: Add GitIndex.add_files_from_index_info()
This is used to add files directly to the index, without touching the
working tree. This is used in the build without commit code for creating
new morphologies pointing to different branches.
Diffstat (limited to 'morphlib/gitindex_tests.py')
-rw-r--r-- | morphlib/gitindex_tests.py | 10 |
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()),[]) |