{"thread":{"id":"59683","subject":"cannot checkout file in partial clone on windows","startedAt":"2023-05-02T13:51:49Z","lastAt":"2023-05-02T13:51:49Z","messageCount":1,"participants":["Anthony Sottile"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"476421","messageId":"CA+dzEBm-uVbsiq26J+Zt10RDg7sEH2FFTwAhbeXOaH_0u0Rx=g@mail.gmail.com","threadId":"59683","inReplyTo":null,"subject":"cannot checkout file in partial clone on windows","fromName":"Anthony Sottile","fromEmail":"asottile@umich.edu","sentAt":"2023-05-02T13:51:26Z","receivedAt":"2023-05-02T13:51:49Z","isPatch":false,"sender":{"key":"asottile@umich.edu","avatar":"https://avatars.githubusercontent.com/u/1810591?v=4"},"body":"this appears to be a windows-specific issue\n\nshort reproduction:\n\n```bash\nset -euxo pipefail\n\nrm -rf t\ngit init t\ncd t\ngit remote add origin https://github.com/pre-commit/pre-commit-hooks\ngit config extensions.partialClone true\ngit fetch origin HEAD --quiet --filter=blob:none --tags\n\ngit checkout v4.4.0 -- .pre-commit-hooks.yaml\n\nls -al\n```\n\non linux it produces this output:\n\n```console\n$ bash t.sh\n+ rm -rf t\n+ git init t\nInitialized empty Git repository in /tmp/t/.git/\n+ cd t\n+ git remote add origin https://github.com/pre-commit/pre-commit-hooks\n+ git config extensions.partialClone true\n+ git fetch origin HEAD --quiet --filter=blob:none --tags\n+ git checkout v4.4.0 -- .pre-commit-hooks.yaml\nremote: Enumerating objects: 1, done.\nremote: Counting objects: 100% (1/1), done.\nremote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\nReceiving objects: 100% (1/1), 1.73 KiB | 1.73 MiB/s, done.\n+ ls -al\ntotal 36\ndrwxr-xr-x  3 asottile asottile  4096 May  2 09:48 .\ndrwxrwxrwt 27 root     root     20480 May  2 09:47 ..\ndrwxr-xr-x  7 asottile asottile  4096 May  2 09:48 .git\n-rw-r--r--  1 asottile asottile  6950 May  2 09:48 .pre-commit-hooks.yaml\n\n```\n\non windows it does the following:\n\n```console\n>bash t.sh\n+ rm -rf t\n+ git init t\nInitialized empty Git repository in\nC:/Users/Anthony/workspace/pre-commit/t/.git/\n+ cd t\n+ git remote add origin https://github.com/pre-commit/pre-commit-hooks\n+ git config extensions.partialClone true\n+ git fetch origin HEAD --quiet --filter=blob:none --tags\n+ git checkout v4.4.0 -- .pre-commit-hooks.yaml\nremote: Enumerating objects: 1, done.\nremote: Counting objects: 100% (1/1), done.\nremote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\nReceiving objects: 100% (1/1), 1.73 KiB | 1.73 MiB/s, done.\nerror: unable to read sha1 file of .pre-commit-hooks.yaml\n(f8523d4a677b2904df1ebf50c826323b2555edeb)\n```\n\nI can work around it by running `git show\nv4.4.0:.pre-commit-hooks.yaml > /dev/null` before the checkout oddly\nenough:\n\n```console\n>bash t.sh\n+ rm -rf t\n+ git init t\nInitialized empty Git repository in\nC:/Users/Anthony/workspace/pre-commit/t/.git/\n+ cd t\n+ git remote add origin https://github.com/pre-commit/pre-commit-hooks\n+ git config extensions.partialClone true\n+ git fetch origin HEAD --quiet --filter=blob:none --tags\n+ git show v4.4.0:.pre-commit-hooks.yaml\nremote: Enumerating objects: 1, done.\nremote: Counting objects: 100% (1/1), done.\nremote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0\nReceiving objects: 100% (1/1), 1.73 KiB | 1.73 MiB/s, done.\n+ git checkout v4.4.0 -- .pre-commit-hooks.yaml\n+ ls -al\ntotal 20\ndrwxr-xr-x 1 Anthony 197609    0 May  2 09:50 .\ndrwxr-xr-x 1 Anthony 197609    0 May  2 09:50 ..\ndrwxr-xr-x 1 Anthony 197609    0 May  2 09:50 .git\n-rw-r--r-- 1 Anthony 197609 6950 May  2 09:50 .pre-commit-hooks.yaml\n```\n\nanthony\n"}]}