chaoss / grimoirelab-graal

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

Graal doesn't work with latest version of Git (2.35.1) #112

Closed jjmerchante closed 2 years ago

jjmerchante commented 2 years ago

When Perceval updates the repository to fetch the items, Git refuses to fetch into the currently checked out branch of any working tree. This change was made in the lastest version of Git (2.35.1): https://github.com/git/git/commit/8bc1f39f411e06b940230dc84da5568dfafec922

  File "/home/runner/work/grimoirelab-graal/grimoirelab-graal/src/perceval/perceval/backends/core/git.py", line 278, in __fetch_from_repo
    commits = self.__fetch_commits_from_repo(repo, from_date, to_date, branches, no_update)
  File "/home/runner/work/grimoirelab-graal/grimoirelab-graal/src/perceval/perceval/backends/core/git.py", line 308, in __fetch_commits_from_repo
    repo.update()
  File "/home/runner/work/grimoirelab-graal/grimoirelab-graal/src/perceval/perceval/backends/core/git.py", line 927, in update
    self._exec(cmd_update, cwd=self.dirpath, env=self.gitenv)
  File "/home/runner/work/grimoirelab-graal/grimoirelab-graal/src/perceval/perceval/backends/core/git.py", line 1349, in _exec
    raise RepositoryError(cause=cause)
perceval.errors.RepositoryError: git command - fatal: refusing to fetch into branch 'refs/heads/master' checked out at '/tmp/worktrees/graaltest'

It only fails when the worktree is created using the following command:

git worktree add /tmp/worktrees/graaltest master

But it doesn't fail when the worktree is created without providing a branch, because the branch name is by default the name of the worktree:

git worktree add /tmp/worktrees/graaltest