From 95b573b753661619161dde85ce66afd533626f43 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Mon, 31 Mar 2025 21:53:58 +0000 Subject: [PATCH] t5605: fix test for cloning from a different user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test currently passes, but for the wrong reason. The repo_is_hardlinked function expects a .git directory or a bare repository and currently fails because it cannot find the objects directory. One solution is to use the --bare argument, but then --show-toplevel won't work. We could change that, but there's no need to, so just add the missing .git directory. In addition, use the built-in negation functionality of test_grep to avoid mishandling real errors (such as a missing file) and, as a final fix, remove the extra newline. Reported-by: SZEDER Gábor Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- t/t5605-clone-local.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/t/t5605-clone-local.sh b/t/t5605-clone-local.sh index 31f6249ac9..4710ca9ece 100755 --- a/t/t5605-clone-local.sh +++ b/t/t5605-clone-local.sh @@ -156,11 +156,10 @@ test_expect_success 'cloning a local path with --no-local does not hardlink' ' test_expect_success 'cloning a local path with --no-local from a different user succeeds' ' git clone --upload-pack="GIT_TEST_ASSUME_DIFFERENT_OWNER=true git-upload-pack" \ --no-local a nonlocal-otheruser 2>err && - ! repo_is_hardlinked nonlocal-otheruser && + ! repo_is_hardlinked nonlocal-otheruser/.git && # Verify that this is a git repository. git -C nonlocal-otheruser rev-parse --show-toplevel && - ! test_grep "detected dubious ownership" err - + test_grep ! "detected dubious ownership" err ' test_expect_success 'cloning locally respects "-u" for fetching refs' '