Skip to content

Commit 6eb59d0

Browse files
authored
Fix switching branches by adding double dash separator (#1390)
* Add hyphens to treat params as Git objects and not files * Adjust test assertions
1 parent af371c2 commit 6eb59d0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: jupyterlab_git/git.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ async def changed_files(self, path, base=None, remote=None, single_commit=None):
312312
elif base == "INDEX":
313313
cmd = ["git", "diff", "--staged", remote, "--name-only", "-z"]
314314
else:
315-
cmd = ["git", "diff", base, remote, "--name-only", "-z"]
315+
cmd = ["git", "diff", base, remote, "--name-only", "-z", "--"]
316316
else:
317317
raise tornado.web.HTTPError(
318318
400, "Either single_commit or (base and remote) must be provided"

Diff for: jupyterlab_git/tests/test_diff.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ async def test_changed_files_two_commits():
112112

113113
# Then
114114
mock_execute.assert_called_once_with(
115-
["git", "diff", "HEAD", "origin/HEAD", "--name-only", "-z"],
115+
["git", "diff", "HEAD", "origin/HEAD", "--name-only", "-z", "--"],
116116
cwd="test-path",
117117
timeout=20,
118118
env=None,
@@ -136,7 +136,7 @@ async def test_changed_files_git_diff_error():
136136

137137
# Then
138138
mock_execute.assert_called_once_with(
139-
["git", "diff", "HEAD", "origin/HEAD", "--name-only", "-z"],
139+
["git", "diff", "HEAD", "origin/HEAD", "--name-only", "-z", "--"],
140140
cwd="test-path",
141141
timeout=20,
142142
env=None,

0 commit comments

Comments
 (0)