{"thread":{"id":"63269","subject":"[PATCH 0/1] t5601: modernize test by using test_path_is_file","startedAt":"2025-04-07T19:55:23Z","lastAt":"2025-04-08T03:01:56Z","messageCount":3,"participants":["ayushjaiswal12123@gmail.com","Lucas Seiki Oshiro"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"515795","messageId":"20250407195505.86-1-ayushjaiswal12123@gmail.com","threadId":"63269","inReplyTo":null,"subject":"[PATCH 0/1] t5601: modernize test by using test_path_is_file","fromName":"","fromEmail":"ayushjaiswal12123@gmail.com","sentAt":"2025-04-07T19:55:03Z","receivedAt":"2025-04-07T19:55:23Z","isPatch":true,"sender":{"key":"ayushjaiswal12123@gmail.com","avatar":null},"body":"From: Ayush Jaiswal <ayushjaiswal12123@gmail.com>\n\nThis patch updates a test in `t5601-clone.sh` to use `test_path_is_file` \ninstead of manually comparing file output using `test_cmp`. \n\nThis aligns the test with Git’s modern test practices and improves readability.\n\nThe updated test was verified to pass using Git's test suite.\n\n\nAyush Jaiswal (1):\n  t5601: modernize test by using test_path_is_file\n\n t/t5601-clone.sh | 948 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 948 insertions(+)\n create mode 100644 t/t5601-clone.sh\n\n-- \n2.49.0-rc0\n\n"},{"id":"515796","messageId":"20250407195505.86-2-ayushjaiswal12123@gmail.com","threadId":"63269","inReplyTo":"20250407195505.86-1-ayushjaiswal12123@gmail.com","subject":"[PATCH 1/1] t5601: modernize test by using test_path_is_file","fromName":"","fromEmail":"ayushjaiswal12123@gmail.com","sentAt":"2025-04-07T19:55:04Z","receivedAt":"2025-04-07T19:55:55Z","isPatch":true,"sender":{"key":"ayushjaiswal12123@gmail.com","avatar":null},"body":"From: Ayush Jaiswal <ayushjaiswal12123@gmail.com>\n\nUpdated a test to use 'test_path_is_file' instead of manually comparing output using 'test_cmp',\nto align with modern Git test style and improve readability.\n\nVerified that all tests pass after this change.\nInitially, test 30 ('clone separate gitdir: output') failed due to incorrect output format.\nFixed the test logic and confirmed all tests pass.\n\nCommand used to find instances to modernize:\n  git grep -F 'test -f' -- t/t5601-clone.sh\n\nSigned-off-by: Ayush Jaiswal <ayushjaiswal12123@gmail.com>\n---\n t/t5601-clone.sh | 948 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 948 insertions(+)\n create mode 100644 t/t5601-clone.sh\n\ndiff --git a/t/t5601-clone.sh b/t/t5601-clone.sh\nnew file mode 100644\nindex 0000000..c9b4e5a\n--- /dev/null\n+++ b/t/t5601-clone.sh\n@@ -0,0 +1,948 @@\n+#!/bin/sh\n+\n+test_description=clone\n+\n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n+\n+. ./test-lib.sh\n+\n+X=\n+test_have_prereq !MINGW || X=.exe\n+\n+test_expect_success setup '\n+\n+\trm -fr .git &&\n+\ttest_create_repo src &&\n+\t(\n+\t\tcd src &&\n+\t\t>file &&\n+\t\tgit add file &&\n+\t\tgit commit -m initial &&\n+\t\techo 1 >file &&\n+\t\tgit add file &&\n+\t\tgit commit -m updated\n+\t)\n+\n+'\n+\n+test_expect_success 'clone with excess parameters (1)' '\n+\n+\trm -fr dst &&\n+\ttest_must_fail git clone -n src dst junk\n+\n+'\n+\n+test_expect_success 'clone with excess parameters (2)' '\n+\n+\trm -fr dst &&\n+\ttest_must_fail git clone -n \"file://$(pwd)/src\" dst junk\n+\n+'\n+\n+test_expect_success 'output from clone' '\n+\trm -fr dst &&\n+\tgit clone -n \"file://$(pwd)/src\" dst >output 2>&1 &&\n+\ttest $(grep Clon output | wc -l) = 1\n+'\n+\n+test_expect_success 'output from clone with core.abbrev does not crash' '\n+\trm -fr dst &&\n+\techo \"Cloning into ${SQ}dst${SQ}...\" >expect &&\n+\tgit -c core.abbrev=12 clone -n \"file://$(pwd)/src\" dst >actual 2>&1 &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'clone does not keep pack' '\n+\n+\trm -fr dst &&\n+\tgit clone -n \"file://$(pwd)/src\" dst &&\n+\t! test -f dst/file &&\n+\t! (echo dst/.git/objects/pack/pack-* | grep \"\\.keep\")\n+\n+'\n+\n+test_expect_success 'clone checks out files' '\n+\n+\trm -fr dst &&\n+\tgit clone src dst &&\n+\ttest_path_is_file dst/file\n+\n+\n+'\n+\n+test_expect_success 'clone respects GIT_WORK_TREE' '\n+\n+\tGIT_WORK_TREE=worktree git clone src bare &&\n+\ttest -f bare/config &&\n+\ttest -f worktree/file\n+\n+'\n+\n+test_expect_success 'clone from hooks' '\n+\n+\ttest_create_repo r0 &&\n+\tcd r0 &&\n+\ttest_commit initial &&\n+\tcd .. &&\n+\tgit init r1 &&\n+\tcd r1 &&\n+\ttest_hook pre-commit <<-\\EOF &&\n+\tgit clone ../r0 ../r2\n+\texit 1\n+\tEOF\n+\t: >file &&\n+\tgit add file &&\n+\ttest_must_fail git commit -m invoke-hook &&\n+\tcd .. &&\n+\ttest_cmp r0/.git/HEAD r2/.git/HEAD &&\n+\ttest_cmp r0/initial.t r2/initial.t\n+\n+'\n+\n+test_expect_success 'clone creates intermediate directories' '\n+\n+\tgit clone src long/path/to/dst &&\n+\ttest -f long/path/to/dst/file\n+\n+'\n+\n+test_expect_success 'clone creates intermediate directories for bare repo' '\n+\n+\tgit clone --bare src long/path/to/bare/dst &&\n+\ttest -f long/path/to/bare/dst/config\n+\n+'\n+\n+test_expect_success 'clone --mirror' '\n+\n+\tgit clone --mirror src mirror &&\n+\ttest -f mirror/HEAD &&\n+\ttest ! -f mirror/file &&\n+\tFETCH=\"$(cd mirror && git config remote.origin.fetch)\" &&\n+\ttest \"+refs/*:refs/*\" = \"$FETCH\" &&\n+\tMIRROR=\"$(cd mirror && git config --bool remote.origin.mirror)\" &&\n+\ttest \"$MIRROR\" = true\n+\n+'\n+\n+test_expect_success 'clone --mirror with detached HEAD' '\n+\n+\t( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) &&\n+\tgit clone --mirror src mirror.detached &&\n+\t( cd src && git checkout - ) &&\n+\tGIT_DIR=mirror.detached git rev-parse HEAD >actual &&\n+\ttest_cmp expected actual\n+\n+'\n+\n+test_expect_success 'clone --bare with detached HEAD' '\n+\n+\t( cd src && git checkout HEAD^ && git rev-parse HEAD >../expected ) &&\n+\tgit clone --bare src bare.detached &&\n+\t( cd src && git checkout - ) &&\n+\tGIT_DIR=bare.detached git rev-parse HEAD >actual &&\n+\ttest_cmp expected actual\n+\n+'\n+\n+test_expect_success 'clone --bare names the local repository <name>.git' '\n+\n+\tgit clone --bare src &&\n+\ttest -d src.git\n+\n+'\n+\n+test_expect_success 'clone --mirror does not repeat tags' '\n+\n+\t(cd src &&\n+\t git tag some-tag HEAD) &&\n+\tgit clone --mirror src mirror2 &&\n+\t(cd mirror2 &&\n+\t git show-ref 2> clone.err > clone.out) &&\n+\t! grep Duplicate mirror2/clone.err &&\n+\tgrep some-tag mirror2/clone.out\n+\n+'\n+\n+test_expect_success 'clone with files ref format' '\n+\ttest_when_finished \"rm -rf ref-storage\" &&\n+\tgit clone --ref-format=files --mirror src ref-storage &&\n+\techo files >expect &&\n+\tgit -C ref-storage rev-parse --show-ref-format >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'clone with garbage ref format' '\n+\tcat >expect <<-EOF &&\n+\tfatal: unknown ref storage format ${SQ}garbage${SQ}\n+\tEOF\n+\ttest_must_fail git clone --ref-format=garbage --mirror src ref-storage 2>err &&\n+\ttest_cmp expect err &&\n+\ttest_path_is_missing ref-storage\n+'\n+\n+test_expect_success 'clone to destination with trailing /' '\n+\n+\tgit clone src target-1/ &&\n+\tT=$( cd target-1 && git rev-parse HEAD ) &&\n+\tS=$( cd src && git rev-parse HEAD ) &&\n+\ttest \"$T\" = \"$S\"\n+\n+'\n+\n+test_expect_success 'clone to destination with extra trailing /' '\n+\n+\tgit clone src target-2/// &&\n+\tT=$( cd target-2 && git rev-parse HEAD ) &&\n+\tS=$( cd src && git rev-parse HEAD ) &&\n+\ttest \"$T\" = \"$S\"\n+\n+'\n+\n+test_expect_success 'clone to an existing empty directory' '\n+\tmkdir target-3 &&\n+\tgit clone src target-3 &&\n+\tT=$( cd target-3 && git rev-parse HEAD ) &&\n+\tS=$( cd src && git rev-parse HEAD ) &&\n+\ttest \"$T\" = \"$S\"\n+'\n+\n+test_expect_success 'clone to an existing non-empty directory' '\n+\tmkdir target-4 &&\n+\t>target-4/Fakefile &&\n+\ttest_must_fail git clone src target-4\n+'\n+\n+test_expect_success 'clone to an existing path' '\n+\t>target-5 &&\n+\ttest_must_fail git clone src target-5\n+'\n+\n+test_expect_success 'clone a void' '\n+\tmkdir src-0 &&\n+\t(\n+\t\tcd src-0 && git init\n+\t) &&\n+\tgit clone \"file://$(pwd)/src-0\" target-6 2>err-6 &&\n+\t! grep \"fatal:\" err-6 &&\n+\t(\n+\t\tcd src-0 && test_commit A\n+\t) &&\n+\tgit clone \"file://$(pwd)/src-0\" target-7 2>err-7 &&\n+\t! grep \"fatal:\" err-7 &&\n+\t# There is no reason to insist they are bit-for-bit\n+\t# identical, but this test should suffice for now.\n+\ttest_cmp target-6/.git/config target-7/.git/config\n+'\n+\n+test_expect_success 'clone respects global branch.autosetuprebase' '\n+\t(\n+\t\ttest_config=\"$HOME/.gitconfig\" &&\n+\t\tgit config -f \"$test_config\" branch.autosetuprebase remote &&\n+\t\trm -fr dst &&\n+\t\tgit clone src dst &&\n+\t\tcd dst &&\n+\t\tactual=\"z$(git config branch.main.rebase)\" &&\n+\t\ttest ztrue = $actual\n+\t)\n+'\n+\n+test_expect_success 'respect url-encoding of file://' '\n+\tgit init x+y &&\n+\tgit clone \"file://$PWD/x+y\" xy-url-1 &&\n+\tgit clone \"file://$PWD/x%2By\" xy-url-2\n+'\n+\n+test_expect_success 'do not query-string-decode + in URLs' '\n+\trm -rf x+y &&\n+\tgit init \"x y\" &&\n+\ttest_must_fail git clone \"file://$PWD/x+y\" xy-no-plus\n+'\n+\n+test_expect_success 'do not respect url-encoding of non-url path' '\n+\tgit init x+y &&\n+\ttest_must_fail git clone x%2By xy-regular &&\n+\tgit clone x+y xy-regular\n+'\n+\n+test_expect_success 'clone separate gitdir' '\n+\trm -rf dst &&\n+\tgit clone --separate-git-dir realgitdir src dst &&\n+\ttest -d realgitdir/refs\n+'\n+\n+test_expect_success 'clone separate gitdir: output' '\n+\tgitdirpath=$(cat dst/.git | sed \"s/gitdir: //\") &&\n+    abs_gitdir=$(cd dst && readlink -f \"$gitdirpath\") &&\n+    echo \"gitdir: $abs_gitdir\" >expected &&\n+    test_cmp expected dst/.git\n+'\n+\n+test_expect_success 'clone from .git file' '\n+\tgit clone dst/.git dst2\n+'\n+\n+test_expect_success 'fetch from .git gitfile' '\n+\t(\n+\t\tcd dst2 &&\n+\t\tgit fetch ../dst/.git\n+\t)\n+'\n+\n+test_expect_success 'fetch from gitfile parent' '\n+\t(\n+\t\tcd dst2 &&\n+\t\tgit fetch ../dst\n+\t)\n+'\n+\n+test_expect_success 'clone separate gitdir where target already exists' '\n+\trm -rf dst &&\n+\techo foo=bar >>realgitdir/config &&\n+\ttest_must_fail git clone --separate-git-dir realgitdir src dst &&\n+\tgrep foo=bar realgitdir/config\n+'\n+\n+test_expect_success 'clone --reference from original' '\n+\tgit clone --shared --bare src src-1 &&\n+\tgit clone --bare src src-2 &&\n+\tgit clone --reference=src-2 --bare src-1 target-8 &&\n+\tgrep /src-2/ target-8/objects/info/alternates\n+'\n+\n+test_expect_success 'clone with more than one --reference' '\n+\tgit clone --bare src src-3 &&\n+\tgit clone --bare src src-4 &&\n+\tgit clone --reference=src-3 --reference=src-4 src target-9 &&\n+\tgrep /src-3/ target-9/.git/objects/info/alternates &&\n+\tgrep /src-4/ target-9/.git/objects/info/alternates\n+'\n+\n+test_expect_success 'clone from original with relative alternate' '\n+\tmkdir nest &&\n+\tgit clone --bare src nest/src-5 &&\n+\techo ../../../src/.git/objects >nest/src-5/objects/info/alternates &&\n+\tgit clone --bare nest/src-5 target-10 &&\n+\tgrep /src/\\\\.git/objects target-10/objects/info/alternates\n+'\n+\n+test_expect_success 'clone checking out a tag' '\n+\tgit clone --branch=some-tag src dst.tag &&\n+\tGIT_DIR=src/.git git rev-parse some-tag >expected &&\n+\tGIT_DIR=dst.tag/.git git rev-parse HEAD >actual &&\n+\ttest_cmp expected actual &&\n+\tGIT_DIR=dst.tag/.git git config remote.origin.fetch >fetch.actual &&\n+\techo \"+refs/heads/*:refs/remotes/origin/*\" >fetch.expected &&\n+\ttest_cmp fetch.expected fetch.actual\n+'\n+\n+test_expect_success 'set up ssh wrapper' '\n+\tcp \"$GIT_BUILD_DIR/t/helper/test-fake-ssh$X\" \\\n+\t\t\"$TRASH_DIRECTORY/ssh$X\" &&\n+\tGIT_SSH=\"$TRASH_DIRECTORY/ssh$X\" &&\n+\texport GIT_SSH &&\n+\texport TRASH_DIRECTORY &&\n+\t>\"$TRASH_DIRECTORY\"/ssh-output\n+'\n+\n+copy_ssh_wrapper_as () {\n+\trm -f \"${1%$X}$X\" &&\n+\tcp \"$TRASH_DIRECTORY/ssh$X\" \"${1%$X}$X\" &&\n+\ttest_when_finished \"rm $(git rev-parse --sq-quote \"${1%$X}$X\")\" &&\n+\tGIT_SSH=\"${1%$X}$X\" &&\n+\ttest_when_finished \"GIT_SSH=\\\"\\$TRASH_DIRECTORY/ssh\\$X\\\"\"\n+}\n+\n+expect_ssh () {\n+\ttest_when_finished '\n+\t\t(cd \"$TRASH_DIRECTORY\" && rm -f ssh-expect && >ssh-output)\n+\t' &&\n+\t{\n+\t\tcase \"$#\" in\n+\t\t1)\n+\t\t\t;;\n+\t\t2)\n+\t\t\techo \"ssh: $1 git-upload-pack '$2'\"\n+\t\t\t;;\n+\t\t3)\n+\t\t\techo \"ssh: $1 $2 git-upload-pack '$3'\"\n+\t\t\t;;\n+\t\t*)\n+\t\t\techo \"ssh: $1 $2 git-upload-pack '$3' $4\"\n+\t\tesac\n+\t} >\"$TRASH_DIRECTORY/ssh-expect\" &&\n+\t(cd \"$TRASH_DIRECTORY\" && test_cmp ssh-expect ssh-output)\n+}\n+\n+test_expect_success 'clone myhost:src uses ssh' '\n+\tGIT_TEST_PROTOCOL_VERSION=0 git clone myhost:src ssh-clone &&\n+\texpect_ssh myhost src\n+'\n+\n+test_expect_success !MINGW,!CYGWIN 'clone local path foo:bar' '\n+\tcp -R src \"foo:bar\" &&\n+\tgit clone \"foo:bar\" foobar &&\n+\texpect_ssh none\n+'\n+\n+test_expect_success 'bracketed hostnames are still ssh' '\n+\tGIT_TEST_PROTOCOL_VERSION=0 git clone \"[myhost:123]:src\" ssh-bracket-clone &&\n+\texpect_ssh \"-p 123\" myhost src\n+'\n+\n+test_expect_success 'OpenSSH variant passes -4' '\n+\tGIT_TEST_PROTOCOL_VERSION=0 git clone -4 \"[myhost:123]:src\" ssh-ipv4-clone &&\n+\texpect_ssh \"-4 -p 123\" myhost src\n+'\n+\n+test_expect_success 'variant can be overridden' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/putty\" &&\n+\tgit -c ssh.variant=putty clone -4 \"[myhost:123]:src\" ssh-putty-clone &&\n+\texpect_ssh \"-4 -P 123\" myhost src\n+'\n+\n+test_expect_success 'variant=auto picks based on basename' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink\" &&\n+\tgit -c ssh.variant=auto clone -4 \"[myhost:123]:src\" ssh-auto-clone &&\n+\texpect_ssh \"-4 -P 123\" myhost src\n+'\n+\n+test_expect_success 'simple does not support -4/-6' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/simple\" &&\n+\ttest_must_fail git clone -4 \"myhost:src\" ssh-4-clone-simple\n+'\n+\n+test_expect_success 'simple does not support port' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/simple\" &&\n+\ttest_must_fail git clone \"[myhost:123]:src\" ssh-bracket-clone-simple\n+'\n+\n+test_expect_success 'uplink is treated as simple' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/uplink\" &&\n+\ttest_must_fail git clone \"[myhost:123]:src\" ssh-bracket-clone-uplink &&\n+\tgit clone \"myhost:src\" ssh-clone-uplink &&\n+\texpect_ssh myhost src\n+'\n+\n+test_expect_success 'OpenSSH-like uplink is treated as ssh' '\n+\twrite_script \"$TRASH_DIRECTORY/uplink\" <<-EOF &&\n+\tif test \"\\$1\" = \"-G\"\n+\tthen\n+\t\texit 0\n+\tfi &&\n+\texec \"\\$TRASH_DIRECTORY/ssh$X\" \"\\$@\"\n+\tEOF\n+\ttest_when_finished \"rm -f \\\"\\$TRASH_DIRECTORY/uplink\\\"\" &&\n+\tGIT_SSH=\"$TRASH_DIRECTORY/uplink\" &&\n+\ttest_when_finished \"GIT_SSH=\\\"\\$TRASH_DIRECTORY/ssh\\$X\\\"\" &&\n+\tGIT_TEST_PROTOCOL_VERSION=0 git clone \"[myhost:123]:src\" ssh-bracket-clone-sshlike-uplink &&\n+\texpect_ssh \"-p 123\" myhost src\n+'\n+\n+test_expect_success 'plink is treated specially (as putty)' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink\" &&\n+\tgit clone \"[myhost:123]:src\" ssh-bracket-clone-plink-0 &&\n+\texpect_ssh \"-P 123\" myhost src\n+'\n+\n+test_expect_success 'plink.exe is treated specially (as putty)' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink.exe\" &&\n+\tgit clone \"[myhost:123]:src\" ssh-bracket-clone-plink-1 &&\n+\texpect_ssh \"-P 123\" myhost src\n+'\n+\n+test_expect_success 'tortoiseplink is like putty, with extra arguments' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/tortoiseplink\" &&\n+\tgit clone \"[myhost:123]:src\" ssh-bracket-clone-plink-2 &&\n+\texpect_ssh \"-batch -P 123\" myhost src\n+'\n+\n+test_expect_success 'double quoted plink.exe in GIT_SSH_COMMAND' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink.exe\" &&\n+\tGIT_SSH_COMMAND=\"\\\"$TRASH_DIRECTORY/plink.exe\\\" -v\" \\\n+\t\tgit clone \"[myhost:123]:src\" ssh-bracket-clone-plink-3 &&\n+\texpect_ssh \"-v -P 123\" myhost src\n+'\n+\n+test_expect_success 'single quoted plink.exe in GIT_SSH_COMMAND' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink.exe\" &&\n+\tGIT_SSH_COMMAND=\"$SQ$TRASH_DIRECTORY/plink.exe$SQ -v\" \\\n+\t\tgit clone \"[myhost:123]:src\" ssh-bracket-clone-plink-4 &&\n+\texpect_ssh \"-v -P 123\" myhost src\n+'\n+\n+test_expect_success 'GIT_SSH_VARIANT overrides plink detection' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink\" &&\n+\tGIT_TEST_PROTOCOL_VERSION=0 GIT_SSH_VARIANT=ssh \\\n+\t\tgit clone \"[myhost:123]:src\" ssh-bracket-clone-variant-1 &&\n+\texpect_ssh \"-p 123\" myhost src\n+'\n+\n+test_expect_success 'ssh.variant overrides plink detection' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink\" &&\n+\tGIT_TEST_PROTOCOL_VERSION=0 git -c ssh.variant=ssh \\\n+\t\tclone \"[myhost:123]:src\" ssh-bracket-clone-variant-2 &&\n+\texpect_ssh \"-p 123\" myhost src\n+'\n+\n+test_expect_success 'GIT_SSH_VARIANT overrides plink detection to plink' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink\" &&\n+\tGIT_SSH_VARIANT=plink \\\n+\tgit clone \"[myhost:123]:src\" ssh-bracket-clone-variant-3 &&\n+\texpect_ssh \"-P 123\" myhost src\n+'\n+\n+test_expect_success 'GIT_SSH_VARIANT overrides plink to tortoiseplink' '\n+\tcopy_ssh_wrapper_as \"$TRASH_DIRECTORY/plink\" &&\n+\tGIT_SSH_VARIANT=tortoiseplink \\\n+\tgit clone \"[myhost:123]:src\" ssh-bracket-clone-variant-4 &&\n+\texpect_ssh \"-batch -P 123\" myhost src\n+'\n+\n+test_expect_success 'clean failure on broken quoting' '\n+\ttest_must_fail \\\n+\t\tenv GIT_SSH_COMMAND=\"${SQ}plink.exe -v\" \\\n+\t\tgit clone \"[myhost:123]:src\" sq-failure\n+'\n+\n+counter=0\n+# $1 url\n+# $2 none|host\n+# $3 path\n+test_clone_url () {\n+\tcounter=$(($counter + 1))\n+\ttest_might_fail env GIT_TEST_PROTOCOL_VERSION=0 git clone \"$1\" tmp$counter &&\n+\tshift &&\n+\texpect_ssh \"$@\"\n+}\n+\n+test_expect_success !MINGW,!CYGWIN 'clone c:temp is ssl' '\n+\ttest_clone_url c:temp c temp\n+'\n+\n+test_expect_success MINGW 'clone c:temp is dos drive' '\n+\ttest_clone_url c:temp none\n+'\n+\n+#ip v4\n+for repo in rep rep/home/project 123\n+do\n+\ttest_expect_success \"clone host:$repo\" '\n+\t\ttest_clone_url host:$repo host $repo\n+\t'\n+done\n+\n+# Parsing of paths that look like IPv6 addresses is broken on Cygwin.\n+expectation_for_ipv6_tests=success\n+if test_have_prereq CYGWIN\n+then\n+\texpectation_for_ipv6_tests=failure\n+fi\n+\n+#ipv6\n+for repo in rep rep/home/project 123\n+do\n+\ttest_expect_$expectation_for_ipv6_tests \"clone [::1]:$repo\" '\n+\t\ttest_clone_url [::1]:$repo ::1 \"$repo\"\n+\t'\n+done\n+\n+# Home directory. All tests that use \"~repo\" are broken in our CI job when the\n+# leak sanitizer is enabled. It seems like either a bug in the sanitizer or in\n+# glibc, but when executing getpwnam(3p) with an invalid username we eventually\n+# start recursing in a call to free(3p), until bust the stack and segfault.\n+test_expect_success !SANITIZE_LEAK \"clone host:/~repo\" '\n+\ttest_clone_url host:/~repo host \"~repo\"\n+'\n+\n+test_expect_$expectation_for_ipv6_tests !SANITIZE_LEAK \"clone [::1]:/~repo\" '\n+\ttest_clone_url [::1]:/~repo ::1 \"~repo\"\n+'\n+\n+# Corner cases\n+for url in foo/bar:baz [foo]bar/baz:qux [foo/bar]:baz\n+do\n+\ttest_expect_success \"clone $url is not ssh\" '\n+\t\ttest_clone_url $url none\n+\t'\n+done\n+\n+#with ssh:// scheme\n+#ignore trailing colon\n+for tcol in \"\" :\n+do\n+\ttest_expect_success \"clone ssh://host.xz$tcol/home/user/repo\" '\n+\t\ttest_clone_url \"ssh://host.xz$tcol/home/user/repo\" host.xz /home/user/repo\n+\t'\n+\t# from home directory\n+\ttest_expect_success !SANITIZE_LEAK \"clone ssh://host.xz$tcol/~repo\" '\n+\t\ttest_clone_url \"ssh://host.xz$tcol/~repo\" host.xz \"~repo\"\n+\t'\n+done\n+\n+# with port number\n+test_expect_success 'clone ssh://host.xz:22/home/user/repo' '\n+\ttest_clone_url \"ssh://host.xz:22/home/user/repo\" \"-p 22 host.xz\" \"/home/user/repo\"\n+'\n+\n+# from home directory with port number\n+test_expect_success !SANITIZE_LEAK 'clone ssh://host.xz:22/~repo' '\n+\ttest_clone_url \"ssh://host.xz:22/~repo\" \"-p 22 host.xz\" \"~repo\"\n+'\n+\n+#IPv6\n+for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]:\n+do\n+\tehost=$(echo $tuah | sed -e \"s/1]:/1]/\" | tr -d \"[]\")\n+\ttest_expect_success \"clone ssh://$tuah/home/user/repo\" \"\n+\t  test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo\n+\t\"\n+done\n+\n+#IPv6 from home directory\n+for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]\n+do\n+\teuah=$(echo $tuah | tr -d \"[]\")\n+\ttest_expect_success !SANITIZE_LEAK \"clone ssh://$tuah/~repo\" \"\n+\t\ttest_clone_url ssh://$tuah/~repo $euah '~repo'\n+\t\"\n+done\n+\n+#IPv6 with port number\n+for tuah in [::1] user@[::1] [user@::1]\n+do\n+\teuah=$(echo $tuah | tr -d \"[]\")\n+\ttest_expect_success \"clone ssh://$tuah:22/home/user/repo\" \"\n+\t  test_clone_url ssh://$tuah:22/home/user/repo '-p 22' $euah /home/user/repo\n+\t\"\n+done\n+\n+#IPv6 from home directory with port number\n+for tuah in [::1] user@[::1] [user@::1]\n+do\n+\teuah=$(echo $tuah | tr -d \"[]\")\n+\ttest_expect_success !SANITIZE_LEAK \"clone ssh://$tuah:22/~repo\" \"\n+\t\t  test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'\n+\t\"\n+done\n+\n+test_expect_success 'clone from a repository with two identical branches' '\n+\n+\t(\n+\t\tcd src &&\n+\t\tgit checkout -b another main\n+\t) &&\n+\tgit clone src target-11 &&\n+\ttest \"z$( cd target-11 && git symbolic-ref HEAD )\" = zrefs/heads/another\n+\n+'\n+\n+test_expect_success 'shallow clone locally' '\n+\tgit clone --depth=1 --no-local src ssrrcc &&\n+\tgit clone ssrrcc ddsstt &&\n+\ttest_cmp ssrrcc/.git/shallow ddsstt/.git/shallow &&\n+\t( cd ddsstt && git fsck )\n+'\n+\n+test_expect_success 'GIT_TRACE_PACKFILE produces a usable pack' '\n+\trm -rf dst.git &&\n+\tGIT_TRACE_PACKFILE=$PWD/tmp.pack git clone --no-local --bare src dst.git &&\n+\tgit init --bare replay.git &&\n+\tgit -C replay.git index-pack -v --stdin <tmp.pack\n+'\n+\n+test_expect_success 'clone on case-insensitive fs' '\n+\tgit init icasefs &&\n+\t(\n+\t\tcd icasefs &&\n+\t\to=$(git hash-object -w --stdin </dev/null | hex2oct) &&\n+\t\tt=$(printf \"100644 X\\0${o}100644 x\\0${o}\" |\n+\t\t\tgit hash-object -w -t tree --stdin) &&\n+\t\tc=$(git commit-tree -m bogus $t) &&\n+\t\tgit update-ref refs/heads/bogus $c &&\n+\t\tgit clone -b bogus . bogus 2>warning\n+\t)\n+'\n+\n+test_expect_success CASE_INSENSITIVE_FS 'colliding file detection' '\n+\tgrep X icasefs/warning &&\n+\tgrep x icasefs/warning &&\n+\ttest_grep \"the following paths have collided\" icasefs/warning\n+'\n+\n+test_expect_success CASE_INSENSITIVE_FS,SYMLINKS \\\n+\t\t'colliding symlink/directory keeps directory' '\n+\tgit init icasefs-colliding-symlink &&\n+\t(\n+\t\tcd icasefs-colliding-symlink &&\n+\t\ta=$(printf a | git hash-object -w --stdin) &&\n+\t\tprintf \"100644 %s 0\\tA/dir/b\\n120000 %s 0\\ta\\n\" $a $a >idx &&\n+\t\tgit update-index --index-info <idx &&\n+\t\ttest_tick &&\n+\t\tgit commit -m initial\n+\t) &&\n+\tgit clone icasefs-colliding-symlink icasefs-colliding-symlink-clone &&\n+\ttest_file_not_empty icasefs-colliding-symlink-clone/A/dir/b\n+'\n+\n+test_expect_success 'clone with GIT_DEFAULT_HASH' '\n+\t(\n+\t\tsane_unset GIT_DEFAULT_HASH &&\n+\t\tgit init --object-format=sha1 test-sha1 &&\n+\t\tgit init --object-format=sha256 test-sha256\n+\t) &&\n+\ttest_commit -C test-sha1 foo &&\n+\ttest_commit -C test-sha256 foo &&\n+\tGIT_DEFAULT_HASH=sha1 git clone test-sha256 test-clone-sha256 &&\n+\tGIT_DEFAULT_HASH=sha256 git clone test-sha1 test-clone-sha1 &&\n+\tgit -C test-clone-sha1 status &&\n+\tgit -C test-clone-sha256 status\n+'\n+\n+partial_clone_server () {\n+\t       SERVER=\"$1\" &&\n+\n+\trm -rf \"$SERVER\" client &&\n+\ttest_create_repo \"$SERVER\" &&\n+\ttest_commit -C \"$SERVER\" one &&\n+\tHASH1=$(git -C \"$SERVER\" hash-object one.t) &&\n+\tgit -C \"$SERVER\" revert HEAD &&\n+\ttest_commit -C \"$SERVER\" two &&\n+\tHASH2=$(git -C \"$SERVER\" hash-object two.t) &&\n+\ttest_config -C \"$SERVER\" uploadpack.allowfilter 1 &&\n+\ttest_config -C \"$SERVER\" uploadpack.allowanysha1inwant 1\n+}\n+\n+partial_clone () {\n+\t       SERVER=\"$1\" &&\n+\t       URL=\"$2\" &&\n+\n+\tpartial_clone_server \"${SERVER}\" &&\n+\tgit clone --filter=blob:limit=0 \"$URL\" client &&\n+\n+\tgit -C client fsck &&\n+\n+\t# Ensure that unneeded blobs are not inadvertently fetched.\n+\ttest_config -C client remote.origin.promisor \"false\" &&\n+\tgit -C client config --unset remote.origin.partialclonefilter &&\n+\ttest_must_fail git -C client cat-file -e \"$HASH1\" &&\n+\n+\t# But this blob was fetched, because clone performs an initial checkout\n+\tgit -C client cat-file -e \"$HASH2\"\n+}\n+\n+test_expect_success 'partial clone' '\n+\tpartial_clone server \"file://$(pwd)/server\"\n+'\n+\n+test_expect_success 'partial clone with -o' '\n+\tpartial_clone_server server &&\n+\tgit clone -o blah --filter=blob:limit=0 \"file://$(pwd)/server\" client &&\n+\ttest_cmp_config -C client \"blob:limit=0\" --get-all remote.blah.partialclonefilter\n+'\n+\n+test_expect_success 'partial clone: warn if server does not support object filtering' '\n+\trm -rf server client &&\n+\ttest_create_repo server &&\n+\ttest_commit -C server one &&\n+\n+\tgit clone --filter=blob:limit=0 \"file://$(pwd)/server\" client 2> err &&\n+\n+\ttest_grep \"filtering not recognized by server\" err\n+'\n+\n+test_expect_success 'batch missing blob request during checkout' '\n+\trm -rf server client &&\n+\n+\ttest_create_repo server &&\n+\techo a >server/a &&\n+\techo b >server/b &&\n+\tgit -C server add a b &&\n+\n+\tgit -C server commit -m x &&\n+\techo aa >server/a &&\n+\techo bb >server/b &&\n+\tgit -C server add a b &&\n+\tgit -C server commit -m x &&\n+\n+\ttest_config -C server uploadpack.allowfilter 1 &&\n+\ttest_config -C server uploadpack.allowanysha1inwant 1 &&\n+\n+\tgit clone --filter=blob:limit=0 \"file://$(pwd)/server\" client &&\n+\n+\t# Ensure that there is only one negotiation by checking that there is\n+\t# only \"done\" line sent. (\"done\" marks the end of negotiation.)\n+\tGIT_TRACE_PACKET=\"$(pwd)/trace\" \\\n+\t\tGIT_TRACE2_EVENT=\"$(pwd)/trace2_event\" \\\n+\t\tgit -C client -c trace2.eventNesting=5 checkout HEAD^ &&\n+\tgrep \\\"key\\\":\\\"total_rounds\\\",\\\"value\\\":\\\"1\\\" trace2_event >trace_lines &&\n+\ttest_line_count = 1 trace_lines &&\n+\tgrep \"fetch> done\" trace >done_lines &&\n+\ttest_line_count = 1 done_lines\n+'\n+\n+test_expect_success 'batch missing blob request does not inadvertently try to fetch gitlinks' '\n+\trm -rf server client &&\n+\n+\ttest_create_repo repo_for_submodule &&\n+\ttest_commit -C repo_for_submodule x &&\n+\n+\ttest_create_repo server &&\n+\techo a >server/a &&\n+\techo b >server/b &&\n+\tgit -C server add a b &&\n+\tgit -C server commit -m x &&\n+\n+\techo aa >server/a &&\n+\techo bb >server/b &&\n+\t# Also add a gitlink pointing to an arbitrary repository\n+\ttest_config_global protocol.file.allow always &&\n+\tgit -C server submodule add \"$(pwd)/repo_for_submodule\" c &&\n+\tgit -C server add a b c &&\n+\tgit -C server commit -m x &&\n+\n+\ttest_config -C server uploadpack.allowfilter 1 &&\n+\ttest_config -C server uploadpack.allowanysha1inwant 1 &&\n+\n+\t# Make sure that it succeeds\n+\tgit clone --filter=blob:limit=0 \"file://$(pwd)/server\" client\n+'\n+\n+. \"$TEST_DIRECTORY\"/lib-httpd.sh\n+start_httpd\n+\n+test_expect_success 'clone with includeIf' '\n+\ttest_when_finished \"rm -rf repo \\\"$HTTPD_DOCUMENT_ROOT_PATH/repo.git\\\"\" &&\n+\tgit clone --bare --no-local src \"$HTTPD_DOCUMENT_ROOT_PATH/repo.git\" &&\n+\n+\ttest_when_finished \"rm \\\"$HOME\\\"/.gitconfig\" &&\n+\tcat >\"$HOME\"/.gitconfig <<-EOF &&\n+\t[includeIf \"onbranch:something\"]\n+\t\tpath = /does/not/exist.inc\n+\tEOF\n+\tgit clone $HTTPD_URL/smart/repo.git repo\n+'\n+\n+test_expect_success 'partial clone using HTTP' '\n+\tpartial_clone \"$HTTPD_DOCUMENT_ROOT_PATH/server\" \"$HTTPD_URL/smart/server\"\n+'\n+\n+test_expect_success 'reject cloning shallow repository using HTTP' '\n+\ttest_when_finished \"rm -rf repo\" &&\n+\tgit clone --bare --no-local --depth=1 src \"$HTTPD_DOCUMENT_ROOT_PATH/repo.git\" &&\n+\ttest_must_fail git -c protocol.version=2 clone --reject-shallow $HTTPD_URL/smart/repo.git repo 2>err &&\n+\ttest_grep -e \"source repository is shallow, reject to clone.\" err &&\n+\n+\tgit clone --no-reject-shallow $HTTPD_URL/smart/repo.git repo\n+'\n+\n+test_expect_success 'auto-discover bundle URI from HTTP clone' '\n+\ttest_when_finished rm -rf trace.txt repo2 \"$HTTPD_DOCUMENT_ROOT_PATH/repo2.git\" &&\n+\tgit -C src bundle create \"$HTTPD_DOCUMENT_ROOT_PATH/everything.bundle\" --all &&\n+\tgit clone --bare --no-local src \"$HTTPD_DOCUMENT_ROOT_PATH/repo2.git\" &&\n+\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo2.git\" config \\\n+\t\tuploadpack.advertiseBundleURIs true &&\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo2.git\" config \\\n+\t\tbundle.version 1 &&\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo2.git\" config \\\n+\t\tbundle.mode all &&\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo2.git\" config \\\n+\t\tbundle.everything.uri \"$HTTPD_URL/everything.bundle\" &&\n+\n+\tGIT_TRACE2_EVENT=\"$(pwd)/trace.txt\" \\\n+\t\tgit -c protocol.version=2 \\\n+\t\t    -c transfer.bundleURI=true clone \\\n+\t\t$HTTPD_URL/smart/repo2.git repo2 &&\n+\tcat >pattern <<-EOF &&\n+\t\"event\":\"child_start\".*\"argv\":\\[\"git-remote-https\",\"$HTTPD_URL/everything.bundle\"\\]\n+\tEOF\n+\tgrep -f pattern trace.txt\n+'\n+\n+test_expect_success 'auto-discover multiple bundles from HTTP clone' '\n+\ttest_when_finished rm -rf trace.txt repo3 \"$HTTPD_DOCUMENT_ROOT_PATH/repo3.git\" &&\n+\n+\ttest_commit -C src new &&\n+\tgit -C src bundle create \"$HTTPD_DOCUMENT_ROOT_PATH/new.bundle\" HEAD~1..HEAD &&\n+\tgit clone --bare --no-local src \"$HTTPD_DOCUMENT_ROOT_PATH/repo3.git\" &&\n+\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo3.git\" config \\\n+\t\tuploadpack.advertiseBundleURIs true &&\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo3.git\" config \\\n+\t\tbundle.version 1 &&\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo3.git\" config \\\n+\t\tbundle.mode all &&\n+\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo3.git\" config \\\n+\t\tbundle.everything.uri \"$HTTPD_URL/everything.bundle\" &&\n+\tgit -C \"$HTTPD_DOCUMENT_ROOT_PATH/repo3.git\" config \\\n+\t\tbundle.new.uri \"$HTTPD_URL/new.bundle\" &&\n+\n+\tGIT_TRACE2_EVENT=\"$(pwd)/trace.txt\" \\\n+\t\tgit -c protocol.version=2 \\\n+\t\t    -c transfer.bundleURI=true clone \\\n+\t\t$HTTPD_URL/smart/repo3.git repo3 &&\n+\n+\t# We should fetch _both_ bundles\n+\tcat >pattern <<-EOF &&\n+\t\"event\":\"child_start\".*\"argv\":\\[\"git-remote-https\",\"$HTTPD_URL/everything.bundle\"\\]\n+\tEOF\n+\tgrep -f pattern trace.txt &&\n+\tcat >pattern <<-EOF &&\n+\t\"event\":\"child_start\".*\"argv\":\\[\"git-remote-https\",\"$HTTPD_URL/new.bundle\"\\]\n+\tEOF\n+\tgrep -f pattern trace.txt\n+'\n+\n+test_expect_success 'auto-discover multiple bundles from HTTP clone: creationToken heuristic' '\n+\ttest_when_finished rm -rf \"$HTTPD_DOCUMENT_ROOT_PATH/repo4.git\" &&\n+\ttest_when_finished rm -rf clone-heuristic trace*.txt &&\n+\n+\ttest_commit -C src newest &&\n+\tgit -C src bundle create \"$HTTPD_DOCUMENT_ROOT_PATH/newest.bundle\" HEAD~1..HEAD &&\n+\tgit clone --bare --no-local src \"$HTTPD_DOCUMENT_ROOT_PATH/repo4.git\" &&\n+\n+\tcat >>\"$HTTPD_DOCUMENT_ROOT_PATH/repo4.git/config\" <<-EOF &&\n+\t[uploadPack]\n+\t\tadvertiseBundleURIs = true\n+\n+\t[bundle]\n+\t\tversion = 1\n+\t\tmode = all\n+\t\theuristic = creationToken\n+\n+\t[bundle \"everything\"]\n+\t\turi = $HTTPD_URL/everything.bundle\n+\t\tcreationtoken = 1\n+\n+\t[bundle \"new\"]\n+\t\turi = $HTTPD_URL/new.bundle\n+\t\tcreationtoken = 2\n+\n+\t[bundle \"newest\"]\n+\t\turi = $HTTPD_URL/newest.bundle\n+\t\tcreationtoken = 3\n+\tEOF\n+\n+\tGIT_TRACE2_EVENT=\"$(pwd)/trace-clone.txt\" \\\n+\t\tgit -c protocol.version=2 \\\n+\t\t    -c transfer.bundleURI=true clone \\\n+\t\t\"$HTTPD_URL/smart/repo4.git\" clone-heuristic &&\n+\n+\tcat >expect <<-EOF &&\n+\t$HTTPD_URL/newest.bundle\n+\t$HTTPD_URL/new.bundle\n+\t$HTTPD_URL/everything.bundle\n+\tEOF\n+\n+\t# We should fetch all bundles in the expected order.\n+\ttest_remote_https_urls <trace-clone.txt >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+# DO NOT add non-httpd-specific tests here, because the last part of this\n+# test script is only executed when httpd is available and enabled.\n+\n+test_done\n-- \n2.49.0-rc0\n\n"},{"id":"515820","messageId":"B0D794A6-64AB-4206-A4E2-2D13E3ADC347@gmail.com","threadId":"63269","inReplyTo":"20250407195505.86-2-ayushjaiswal12123@gmail.com","subject":"Re: [PATCH 1/1] t5601: modernize test by using test_path_is_file","fromName":"Lucas Seiki Oshiro","fromEmail":"lucasseikioshiro@gmail.com","sentAt":"2025-04-08T03:01:43Z","receivedAt":"2025-04-08T03:01:56Z","isPatch":true,"sender":{"key":"lucasseikioshiro@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701580?v=4"},"body":"Hi!\n\nTwo things about your patch:\n\n1. Given that you sent only a patch, you could do that without a cover\n   letter, sending all the additional description that you want after \n   the scissors mark (the ---);\n\n2. Your patch is adding the entire t5601.sh file. I could compare this\n   with the file on the next branch, where I see that you indeed changed\n   the line 69 for using `test_path_is_file`.\n\nI suggest you to send a v2 containing only the changes that you did to\nthat file, instead of a patch that creates this entire file.\n"}]}