From 624eb284e0e6edc4aabf0afbdc1438e32d13f4c9 Mon Sep 17 00:00:00 2001 From: Arnaud Patard Date: Mon, 28 Sep 2020 12:24:33 +0000 Subject: git/repo/base.py: is_dirty(): Fix pathspec handling It's possible to specify a pathspec (eg :!foo) to git diff/status/... but it currently fails with: git.exc.GitCommandError: Cmd('/usr/bin/git') failed due to: exit code(128) cmdline: /usr/bin/git diff --abbrev=40 --full-index --raw :!foo stderr: 'fatal: ambiguous argument ':!foo': unknown revision or path not in the working tree. Add missing '--' to the arguments to fix this ambiguity Signed-off-by: Arnaud Patard --- git/repo/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/repo/base.py') diff --git a/git/repo/base.py b/git/repo/base.py index 2579a7d7..69e3e313 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -639,7 +639,7 @@ class Repo(object): if not submodules: default_args.append('--ignore-submodules') if path: - default_args.append(path) + default_args.extend(["--", path]) if index: # diff index against HEAD if osp.isfile(self.index.path) and \ -- cgit v1.2.3