Skip to content

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

Description

@apatard

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)

Activity

  1. Byron commented on Sep 28, 2020

    @Byron
    Member

    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

  2. added this to the v3.1.9 - Bugfixes milestone on Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions