Repository: iterative/dvc

Issue:
error when pulling in a new git clone 
after performing a git clone of a dvc enabled repository

`dvc pull data/
`
`Unexpected exception while processing targets: [Errno 2] No such file or directory: '.cache/1.csv_e202149'
`



Discussion:

Resolving patch:
diff --git a/dvc/data_cloud.py b/dvc/data_cloud.py
--- a/dvc/data_cloud.py
+++ b/dvc/data_cloud.py
@@ -148,7 +148,7 @@ def push(self, item):
     def pull(self, item):
         fname = item.resolved_cache.dvc
         key_name = self.cache_file_key(fname)
-
+        self.create_directory(item)
         return self._import(self.storage_bucket, key_name, fname, item)
 
     def import_data(self, url, item):
@@ -162,7 +162,6 @@ def sync(self, fname):
         if os.path.isfile(item.resolved_cache.dvc):
             return self.push(item)
         else:
-            self.create_directory(item)
             return self.pull(item)
 
     def create_directory(self, item):


Test patch:
diff --git a/tests/test_workflow.py b/tests/test_workflow.py
--- a/tests/test_workflow.py
+++ b/tests/test_workflow.py
@@ -27,10 +27,14 @@ def workflow_basic_test(self):
 
         self.assertEqual(len(wf._commits), 4)
 
-        self.assertEqual(wf._commits['1'].text, self._commit1._comment + '\n' + self._commit1.hash)
-        self.assertEqual(wf._commits['2'].text, self._commit2._comment + '\n' + self._commit2.hash)
-        self.assertEqual(wf._commits['3'].text, self._commit3._comment + '\n' + self._commit3.hash)
-        self.assertEqual(wf._commits['4'].text, self._commit4._comment + '\n' + self._commit4.hash)
+        self.assertEqual(wf._commits['1'].text,
+                         self._commit1._comment + '\n' + self._commit1._text_hash())
+        self.assertEqual(wf._commits['2'].text,
+                         self._commit2._comment + '\n' + self._commit2._text_hash())
+        self.assertEqual(wf._commits['3'].text,
+                         self._commit3._comment + '\n' + self._commit3._text_hash())
+        self.assertEqual(wf._commits['4'].text,
+                         self._commit4._comment + '\n' + self._commit4._text_hash())
         pass
 
     def collapse_test(self):
@@ -43,7 +47,8 @@ def collapse_test(self):
         wf.collapse_repro_commits()
 
         self.assertEqual(len(wf._commits), 3)
-        self.assertEqual(wf._commits[self._commit1.hash].text, self._commit1._comment + '\n' + self._commit1.hash)
+        self.assertEqual(wf._commits[self._commit1.hash].text,
+                         self._commit1._comment + '\n' + self._commit1._text_hash())
         self.assertEqual(wf._commits[self._commit3.hash].text, Commit.COLLAPSED_TEXT)
         self.assertTrue('2' not in wf._commits)
 
@@ -61,7 +66,8 @@ def collapse_at_dead_end_test(self):
         wf.collapse_repro_commits()
         self.assertEqual(len(wf._commits), 2)
 
-        self.assertEqual(wf._commits[self._commit1.hash].text, self._commit1._comment + '\n' + self._commit1.hash)
+        self.assertEqual(wf._commits[self._commit1.hash].text,
+                         self._commit1._comment + '\n' + self._commit1._text_hash())
         self.assertEqual(wf._commits[self._commit3.hash].text, Commit.COLLAPSED_TEXT)
         self.assertTrue('2' not in wf._commits)
         pass
@@ -83,4 +89,4 @@ def collapse_metric_commit_test(self):
 
         self.assertEqual(wf._commits['3']._target_metric, value)
         self.assertEqual(wf._commits['3'].branch_tips, branches)
-        pass
\ No newline at end of file
+        pass