Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False,
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 \
Expand Down
14 changes: 14 additions & 0 deletions test/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,20 @@ def test_is_dirty(self):
assert self.rorepo.is_dirty() is False
self.rorepo._bare = orig_val

def test_is_dirty_pathspec(self):
self.rorepo._bare = False
for index in (0, 1):
for working_tree in (0, 1):
for untracked_files in (0, 1):
assert self.rorepo.is_dirty(index, working_tree, untracked_files, path=':!foo') in (True, False)
# END untracked files
# END working tree
# END index
orig_val = self.rorepo._bare
self.rorepo._bare = True
assert self.rorepo.is_dirty() is False
self.rorepo._bare = orig_val

@with_rw_repo('HEAD')
def test_is_dirty_with_path(self, rwrepo):
assert rwrepo.is_dirty(path="git") is False
Expand Down