diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-03-07 12:29:19 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-03-07 12:41:32 +0000 |
commit | fbce0142fb9ff9c9187cdcb67bc3a2981e78ff69 (patch) | |
tree | d74b0edb17efd08c33140d49a564474574fb9eeb /morphlib/gitdir.py | |
parent | 8cf3add90b3eb28778e1d62cec77e72e16609414 (diff) | |
download | morph-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.py')
-rw-r--r-- | morphlib/gitdir.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/morphlib/gitdir.py b/morphlib/gitdir.py index f5ef0061..15079231 100644 --- a/morphlib/gitdir.py +++ b/morphlib/gitdir.py @@ -478,7 +478,8 @@ class GitDirectory(object): if dirpath == self.dirname and '.git' in subdirs: subdirs.remove('.git') for filename in filenames: - yield os.path.join(dirpath, filename)[len(self.dirname)+1:] + filepath = os.path.join(dirpath, filename) + yield os.path.relpath(filepath, start=self.dirname) def _list_files_in_ref(self, ref): tree = self.resolve_ref_to_tree(ref) |