Skip to content

Commit

Permalink
test case to verify that a subdirectory restore results in the same hash
Browse files Browse the repository at this point in the history
  • Loading branch information
jfischer committed Mar 30, 2019
1 parent 3f12283 commit 5ea8b42
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_git_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ def test_checkout_and_apply_commit(self):
'subdir/to_be_modified.txt', 'root_file1.txt'])
self._run(['commit', '-m', 'initial version'])
initial_hash = get_local_head_hash(TEMPDIR, True)
subdir_hash = get_subdirectory_hash(TEMPDIR, 'subdir', verbose=True)

self._run(['rm', 'subdir/to_be_deleted.txt'])
with open(join(TEMPDIR, 'subdir/to_be_modified.txt'), 'a') as f:
Expand Down Expand Up @@ -349,6 +350,8 @@ def test_checkout_and_apply_commit(self):
"root file v1\nroot file v2")
restored_hash = get_local_head_hash(TEMPDIR, True)
self.assertNotEqual(initial_hash, restored_hash) # should be differemt
restored_subdir_hash = get_subdirectory_hash(TEMPDIR, 'subdir', verbose=True)
self.assertEqual(subdir_hash, restored_subdir_hash)

# add a commit at this point
with open(join(TEMPDIR, 'subdir/to_be_modified.txt'), 'a') as f:
Expand Down

0 comments on commit 5ea8b42

Please sign in to comment.