Skip to content

Crash with git 2.30.3 - GitCommandError(remove_password_if_present...) #1431

@nvuillam

Description

@nvuillam

Since git 2.30.3 has been released, all MegaLinter CI jobs are failing because of the following error within gitpython.

File "/tmp/lint/megalinter/utils.py", line 229, in list_updated_files
    changed_files = [item.a_path for item in repo.index.diff(None)]
  File "/usr/local/lib/python3.9/site-packages/git/index/base.py", line [1309](https://github.com/megalinter/megalinter/runs/6028533814?check_suite_focus=true#step:5:1309), in diff
    return super(IndexFile, self).diff(other, paths, create_patch, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/git/diff.py", line 175, in diff
    index = diff_method(self.repo, proc)
  File "/usr/local/lib/python3.9/site-packages/git/diff.py", line 570, in _index_from_raw_format
    handle_process_output(proc, lambda byt: cls._handle_diff_line(byt, repo, index),
  File "/usr/local/lib/python3.9/site-packages/git/cmd.py", line 176, in handle_process_output
    return finalizer(process)
  File "/usr/local/lib/python3.9/site-packages/git/util.py", line 386, in finalize_process
    proc.wait(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/git/cmd.py", line 502, in wait
    raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(129)
  cmdline: git diff --abbrev=40 --full-index -M --raw -z --no-color

The gitpython code called is a simple repo.index.diff(None)

def list_updated_files(repo_home):
    try:
        repo = git.Repo(repo_home)
    except git.InvalidGitRepositoryError:
        try:
            repo = git.Repo(REPO_HOME_DEFAULT)
        except git.InvalidGitRepositoryError:
            logging.warning("Unable to find git repository to list updated files")
            return []
    changed_files = [item.a_path for item in repo.index.diff(None)]
    return changed_files

I've investigated for some time and the delta between working / not working really seems to be from using git 2.30.3 instead of 2.30.2

You can see the error in this CI job for example: https://github.com/megalinter/megalinter/runs/6028533814?check_suite_focus=true

Would you have some tip to bypass such error ?

Many thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions