From 2679fe233673505670da8a19592c9baba76f4563 Mon Sep 17 00:00:00 2001 From: Paul Hoger Date: Thu, 23 Jan 2025 16:26:03 +0100 Subject: [PATCH 1/2] Add hyphens to treat params as Git objects and not files --- jupyterlab_git/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 120c5afe1fe6ada45188de5169e6cc0ed19fde57 Mon Sep 17 00:00:00 2001 From: Paul Hoger Date: Mon, 10 Feb 2025 16:43:32 +0100 Subject: [PATCH 2/2] Adjust test assertions --- jupyterlab_git/tests/test_diff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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,