mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Merge pull request #431 from efiop/master
dvc: don't add regular files to gitignore
This commit is contained in:
+4
-2
@@ -293,7 +293,8 @@ class Stage(object):
|
||||
def remove_outs(self):
|
||||
for out in self.outs:
|
||||
out.remove()
|
||||
self.project.scm.ignore_remove(out.path)
|
||||
if out.use_cache:
|
||||
self.project.scm.ignore_remove(out.path)
|
||||
|
||||
def remove(self):
|
||||
self.remove_outs()
|
||||
@@ -353,7 +354,8 @@ class Stage(object):
|
||||
for out in self.outs:
|
||||
out.update()
|
||||
out.save()
|
||||
self.project.scm.ignore(out.path)
|
||||
if out.use_cache:
|
||||
self.project.scm.ignore(out.path)
|
||||
|
||||
def run(self):
|
||||
if not self.is_data_source:
|
||||
|
||||
@@ -75,6 +75,7 @@ class TestGitIgnoreBasic(CheckoutBase):
|
||||
def test(self):
|
||||
fname1 = 'file_1'
|
||||
fname2 = 'file_2'
|
||||
fname3 = 'file_3'
|
||||
|
||||
self.dvc.scm.add(self.dvc.scm.untracked_files())
|
||||
self.dvc.scm.commit('add all files')
|
||||
@@ -83,15 +84,18 @@ class TestGitIgnoreBasic(CheckoutBase):
|
||||
|
||||
self.commit_data_file(fname1)
|
||||
self.commit_data_file(fname2)
|
||||
self.dvc.run(cmd='python {} {} {}'.format(self.CODE, self.FOO, fname3),
|
||||
deps=[self.CODE, self.FOO],
|
||||
outs_no_cache=[fname3])
|
||||
|
||||
self.assertTrue(os.path.exists(self.GIT_IGNORE))
|
||||
|
||||
ignored = self.read_ignored()
|
||||
|
||||
self.assertEqual(len(ignored), 2) # FAILS!!!
|
||||
self.assertEqual(len(ignored), 2)
|
||||
|
||||
self.assertIn(fname1, ignored)
|
||||
self.assertIn(fname2, ignored) # FAILS!!!
|
||||
self.assertIn(fname2, ignored)
|
||||
|
||||
|
||||
class TestGitIgnoreWhenCheckout(CheckoutBase):
|
||||
@@ -120,4 +124,4 @@ class TestGitIgnoreWhenCheckout(CheckoutBase):
|
||||
self.dvc.scm.checkout(branch_1)
|
||||
main(['checkout'])
|
||||
ignored = self.read_ignored()
|
||||
self.assertIn(fname_branch, ignored) # FAILS!!!
|
||||
self.assertIn(fname_branch, ignored)
|
||||
|
||||
Reference in New Issue
Block a user