Skip to content

git diff error silenced #18

@amenasria

Description

@amenasria

Hey there 👋,

Stumbled upon some issues while working with golangci-lint.

Basically the fact that only the exit code is printed in the git diff calls in the GitPatch function but not the git diff stderr makes it really hard for people to debug. I have 2 use cases from this golangci-lint issue when using the new-from-rev feature:

  • In one case the new-from-rev commit was not in the commit tree because the Github Actions runner only had a shallow clone of the repository. From the error people just understood that the diff was not working. Having the error message would have made people understand it directly.
  • In another case (mine) the git diff didn't work because of a diff algorithm that couldn't be found in the runner. This wasn't understandable as well because no error, only the exit code.

For both issues the errors were the same:

level=warning msg="[runner] Can't process result by diff processor:
can't prepare diff by revgrep: could not read git repo: 
error executing git diff \"{revisionFrom}\" \"\"
: exit status 128"

As no one stumbled upon the seconde case I really thought I was in the same situation as the first case which made me spend a lot of time on the fix. I think it'd be a great improvment to have the error in the fmt.Errorf message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions