diff --git a/dvc/scm.py b/dvc/scm.py index 3b453aa5c..cb7bf107b 100644 --- a/dvc/scm.py +++ b/dvc/scm.py @@ -109,10 +109,9 @@ class Git(Base): return self.GITIGNORE def _get_gitignore(self, path): + assert os.path.isabs(path) entry = os.path.basename(path) - gitignore = os.path.join(os.path.abspath(os.path.dirname(path)), - self.GITIGNORE) - gitignore = os.path.abspath(os.path.realpath(gitignore)) + gitignore = os.path.join(os.path.dirname(path), self.GITIGNORE) if not gitignore.startswith(self.root_dir): raise FileNotInRepoError(path) diff --git a/tests/test_scm.py b/tests/test_scm.py index aa54661eb..9f7a4b51c 100644 --- a/tests/test_scm.py +++ b/tests/test_scm.py @@ -35,13 +35,14 @@ class TestIgnore(TestGit): def test(self): git = Git(self._root_dir) + foo = os.path.join(self._root_dir, self.FOO) - git.ignore('foo') + git.ignore(foo) self.assertTrue(os.path.isfile(Git.GITIGNORE)) self.assertEqual(self._count_gitignore(), 1) - git.ignore('foo') + git.ignore(foo) self.assertEqual(self._count_gitignore(), 1) - git.ignore_remove('foo') + git.ignore_remove(foo) self.assertEqual(self._count_gitignore(), 0)