Skip to content

repo.is_dirty() is not working with a pathspec #1061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
apatard opened this issue Sep 28, 2020 · 1 comment · Fixed by #1062
Closed

repo.is_dirty() is not working with a pathspec #1061

apatard opened this issue Sep 28, 2020 · 1 comment · Fixed by #1062

Comments

@apatard
Copy link
Contributor

apatard commented Sep 28, 2020

Using a pathspec like ':!foo' as argument to repo.is_dirty() will result in :

git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git diff --cached --abbrev=40 --full-index --raw :!foo
  stderr: 'fatal: ambiguous argument '!foo': unknown revision or path not in the working tree.

The code should be adding a -- before the path to avoid any ambiguity. For instance, like that:

        if path:
            default_args.append('--')
            default_args.append(path)
@Byron
Copy link
Member

Byron commented Sep 28, 2020

Thanks for taking a look and offering up a solution. It looks like the corresponding change would have to be done here, and a PR would be very welcome.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants