From cc53ed27c206d176e1221da4364798e2657c4746 Mon Sep 17 00:00:00 2001 From: Alexander Schepanovski Date: Mon, 8 Jul 2019 14:52:04 +0700 Subject: [PATCH] dvc: stop trying to fetch from remote when looking for git object Closes #2213 --- dvc/scm/git/tree.py | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/dvc/scm/git/tree.py b/dvc/scm/git/tree.py index e00a8b18cb..89c593c54d 100644 --- a/dvc/scm/git/tree.py +++ b/dvc/scm/git/tree.py @@ -78,32 +78,12 @@ def _is_tree_and_contains(obj, path): return True return False - def _try_fetch_from_remote(self): - import git - - try: - # checking if tag/branch exists locally - self.git.git.show_ref(self.rev, verify=True) - return - except git.exc.GitCommandError: - pass - - try: - # checking if it exists on the remote - self.git.git.ls_remote("origin", self.rev, exit_code=True) - # fetching remote tag/branch so we can reference it locally - self.git.git.fetch("origin", "{rev}:{rev}".format(rev=self.rev)) - except git.exc.GitCommandError: - pass - def git_object_by_path(self, path): import git path = relpath(os.path.realpath(path), self.git.working_dir) assert path.split(os.sep, 1)[0] != ".." - self._try_fetch_from_remote() - try: tree = self.git.tree(self.rev) except git.exc.BadName as exc: