mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-08 23:09:48 +01:00
Merge pull request #658 from seqpipe/add-directory-with-slash
Proper adding of 'directory/'
This commit is contained in:
+1
-1
@@ -81,7 +81,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,
|
||||
|
||||
@@ -48,6 +48,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