summaryrefslogtreecommitdiff
path: root/morphlib/gitdir_tests.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-03-07 12:29:19 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-03-07 12:41:32 +0000
commitfbce0142fb9ff9c9187cdcb67bc3a2981e78ff69 (patch)
treed74b0edb17efd08c33140d49a564474574fb9eeb /morphlib/gitdir_tests.py
parent8cf3add90b3eb28778e1d62cec77e72e16609414 (diff)
downloadmorph-fbce0142fb9ff9c9187cdcb67bc3a2981e78ff69.tar.gz
Fix `morph petrify` in cases where root repo URL has a trailing /
gitdir._list_work_tree_files() needs to use os.relpath() instead of direct string manipulation to avoid chopping off the first line of every filename in cases where the base gitdir path string includes the trailing /. Unit test updated to catch this.
Diffstat (limited to 'morphlib/gitdir_tests.py')
-rw-r--r--morphlib/gitdir_tests.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/morphlib/gitdir_tests.py b/morphlib/gitdir_tests.py
index 8c312c1b..14b2a57a 100644
--- a/morphlib/gitdir_tests.py
+++ b/morphlib/gitdir_tests.py
@@ -82,9 +82,13 @@ class GitDirectoryContentsTests(unittest.TestCase):
shutil.rmtree(self.tempdir)
def test_lists_files_in_work_tree(self):
+ expected = ['bar.morph', 'baz.morph', 'foo.morph', 'quux']
+
gd = morphlib.gitdir.GitDirectory(self.dirname)
- self.assertEqual(sorted(gd.list_files()),
- ['bar.morph', 'baz.morph', 'foo.morph', 'quux'])
+ self.assertEqual(sorted(gd.list_files()), expected)
+
+ gd = morphlib.gitdir.GitDirectory(self.dirname + '/')
+ self.assertEqual(sorted(gd.list_files()), expected)
def test_read_file_in_work_tree(self):
gd = morphlib.gitdir.GitDirectory(self.dirname)