mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-09 15:28:26 +01:00
Proper adding of 'directory/'
* added a test for adding single level directory with forward slash in the end * normalizing the path that is passed to the add method
This commit is contained in:
+1
-1
@@ -80,7 +80,7 @@ class Project(object):
|
||||
return os.path.relpath(path, self.root_dir)
|
||||
|
||||
def add(self, fname):
|
||||
out = os.path.basename(fname)
|
||||
out = os.path.basename(os.path.normpath(fname))
|
||||
stage_fname = out + Stage.STAGE_FILE_SUFFIX
|
||||
cwd = os.path.dirname(os.path.abspath(fname))
|
||||
stage = Stage.loads(project=self,
|
||||
|
||||
@@ -49,6 +49,13 @@ class TestAddDirectory(TestDvc):
|
||||
self.create(os.path.join(dname, 'file'), 'file')
|
||||
self.dvc.add(dname)
|
||||
|
||||
class TestAddDirectoryWithForwardSlash(TestDvc):
|
||||
def test(self):
|
||||
dname = 'directory/'
|
||||
os.mkdir(dname)
|
||||
self.create(os.path.join(dname, 'file'), 'file')
|
||||
stage = self.dvc.add(dname)
|
||||
self.assertEquals(os.path.abspath('directory.dvc'), stage.path)
|
||||
|
||||
class TestAddTrackedFile(TestDvc):
|
||||
def test(self):
|
||||
|
||||
Reference in New Issue
Block a user