I was trying to clone a repository (hosted through JGit, just in case it matters) that has a subdirectory with a subtree. When I clone the repository, the directory gets corrupted, turning into a file with no permissions, not even reading. This causes other operations, like pull, to fail because they can't open that file. Here's the traceback from trying to pull, because cloning doesn't raise any errors (I anonymized the names just in case, it's a internal project):
In [20]: repo.pull(origin_uri='http://192.168.0.42/repository')
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
<ipython-input-20-c27ea9c87ec2> in <module>()
----> 1 repo.pull(origin_uri='http://192.168.0.42/repository')
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in pull(self, origin_uri, branch_name)
358 # Like: git pull
359 def pull(self, origin_uri=None, branch_name=None):
--> 360 return self.pull_from(origin_uri, branch_name)
361
362 def fetch_remote(self, origin_uri=None):
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in pull_from(self, origin_uri, branch_name)
354
355 def pull_from(self, origin_uri, branch_name=None):
--> 356 return self.fetch(origin_uri)
357
358 # Like: git pull
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in fetch(self, origin_uri, bare, origin)
420 # Checkout working directories
421 if not bare and self.has_commits:
--> 422 self.checkout_all()
423 else:
424 self.update_server_info()
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in checkout_all(self, commit_sha)
733 commit_tree = self._commit_tree(commit_sha)
734 # Rebuild index from the current tree
--> 735 return self._checkout_tree(commit_tree)
736
737 def checkout(self, ref):
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in f(self, *args, **kwargs)
45 def f(self, *args, **kwargs):
46 assert self.is_working, "%s can not be called on a bare repository" % method.func_name
---> 47 return method(self, *args, **kwargs)
48 return f
49
/usr/local/lib/python2.7/dist-packages/gittle/gittle.pyc in _checkout_tree(self, tree)
726 self.repo.index_path(),
727 self.repo.object_store,
--> 728 tree
729 )
730
/usr/local/lib/python2.7/dist-packages/dulwich/index.pyc in build_index_from_tree(prefix, index_path, object_store, tree_id, honor_filemode)
439 raise
440 else:
--> 441 f = open(full_path, 'wb')
442 try:
443 # Write out file
IOError: [Errno 13] Permission denied: '/tmp/repo/subtree-directory'
We ended up deciding to just remove this subtree: it's unused code anyway, and it only happens on one repository. However, I'm opening the issue just to register the problem. I can try to run some more tests if you guys need more data, but I can't give you the original offending repository for the reasons stated before.
I was trying to clone a repository (hosted through JGit, just in case it matters) that has a subdirectory with a subtree. When I clone the repository, the directory gets corrupted, turning into a file with no permissions, not even reading. This causes other operations, like pull, to fail because they can't open that file. Here's the traceback from trying to pull, because cloning doesn't raise any errors (I anonymized the names just in case, it's a internal project):
We ended up deciding to just remove this subtree: it's unused code anyway, and it only happens on one repository. However, I'm opening the issue just to register the problem. I can try to run some more tests if you guys need more data, but I can't give you the original offending repository for the reasons stated before.