diff --git a/jupyterlab_git/git.py b/jupyterlab_git/git.py index e3b3bac25..2859bfb5f 100644 --- a/jupyterlab_git/git.py +++ b/jupyterlab_git/git.py @@ -312,7 +312,7 @@ async def changed_files(self, path, base=None, remote=None, single_commit=None): elif base == "INDEX": cmd = ["git", "diff", "--staged", remote, "--name-only", "-z"] else: - cmd = ["git", "diff", base, remote, "--name-only", "-z"] + cmd = ["git", "diff", base, remote, "--name-only", "-z", "--"] else: raise tornado.web.HTTPError( 400, "Either single_commit or (base and remote) must be provided" diff --git a/jupyterlab_git/tests/test_diff.py b/jupyterlab_git/tests/test_diff.py index 8b1e8dcad..d6a046760 100644 --- a/jupyterlab_git/tests/test_diff.py +++ b/jupyterlab_git/tests/test_diff.py @@ -112,7 +112,7 @@ async def test_changed_files_two_commits(): # Then mock_execute.assert_called_once_with( - ["git", "diff", "HEAD", "origin/HEAD", "--name-only", "-z"], + ["git", "diff", "HEAD", "origin/HEAD", "--name-only", "-z", "--"], cwd="test-path", timeout=20, env=None, @@ -136,7 +136,7 @@ async def test_changed_files_git_diff_error(): # Then mock_execute.assert_called_once_with( - ["git", "diff", "HEAD", "origin/HEAD", "--name-only", "-z"], + ["git", "diff", "HEAD", "origin/HEAD", "--name-only", "-z", "--"], cwd="test-path", timeout=20, env=None,