chaoss / grimoirelab-graal

A Generic Repository AnALyzer
GNU General Public License v3.0
23 stars 62 forks source link

git command - fatal: destination path, repo already exists and is not an empty directory #95

Open valeriocos opened 4 years ago

valeriocos commented 4 years ago

When executing the docker 3p container, the error below appears after the second execution (included).

2020-05-23 20:59:34,981 - grimoire_elk.elk - ERROR - Error feeding raw from cocom (https://github.com/chaoss/grimoirelab-toolkit): git command - fatal: destination path '/home/grimoirelab/.graal/repositories/https://github.com/chaoss/grimoirelab-toolkit-git' already exists and is not an empty directory.
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/elk.py", line 228, in feed_backend
    ocean_backend.feed(**params)
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/raw/elastic.py", line 230, in feed
    self.feed_items(items)
  File "/usr/local/lib/python3.5/dist-packages/grimoire_elk/raw/elastic.py", line 246, in feed_items
    for item in items:
  File "/usr/local/lib/python3.5/dist-packages/perceval/backend.py", line 215, in fetch
    for item in self.fetch_items(category, **kwargs):
  File "/usr/local/lib/python3.5/dist-packages/graal/graal.py", line 166, in fetch_items
    self.graalRepo = self.__create_graal_repository()
  File "/usr/local/lib/python3.5/dist-packages/graal/graal.py", line 251, in __create_graal_repository
    repo = GraalRepository.clone(self.uri, self.gitpath)
  File "/usr/local/lib/python3.5/dist-packages/perceval/backends/core/git.py", line 826, in clone
    cls._exec(cmd, env=env)
  File "/usr/local/lib/python3.5/dist-packages/perceval/backends/core/git.py", line 1331, in _exec
    raise RepositoryError(cause=cause)
perceval.errors.RepositoryError: git command - fatal: destination path '/home/grimoirelab/.graal/repositories/https://github.com/chaoss/grimoirelab-toolkit-git' already exists and is not an empty directory.
vinhbt commented 7 months ago

In file: grimoirelab-graal/graal/graal.py, function def fetch_items(self, category, **kwargs): When exception occur logger.error("Analysis failed at %s" % commit['commit']) => graalRepo not be prune so I think should be add self.graalRepo.prune() before raise exception.