cannot checkout file in partial clone on windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this appears to be a windows-specific issue

short reproduction:

```bash
set -euxo pipefail

rm -rf t
git init t
cd t
git remote add origin https://github.com/pre-commit/pre-commit-hooks
git config extensions.partialClone true
git fetch origin HEAD --quiet --filter=blob:none --tags

git checkout v4.4.0 -- .pre-commit-hooks.yaml

ls -al
```

on linux it produces this output:

```console
$ bash t.sh
+ rm -rf t
+ git init t
Initialized empty Git repository in /tmp/t/.git/
+ cd t
+ git remote add origin https://github.com/pre-commit/pre-commit-hooks
+ git config extensions.partialClone true
+ git fetch origin HEAD --quiet --filter=blob:none --tags
+ git checkout v4.4.0 -- .pre-commit-hooks.yaml
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (1/1), 1.73 KiB | 1.73 MiB/s, done.
+ ls -al
total 36
drwxr-xr-x  3 asottile asottile  4096 May  2 09:48 .
drwxrwxrwt 27 root     root     20480 May  2 09:47 ..
drwxr-xr-x  7 asottile asottile  4096 May  2 09:48 .git
-rw-r--r--  1 asottile asottile  6950 May  2 09:48 .pre-commit-hooks.yaml

```

on windows it does the following:

```console
>bash t.sh
+ rm -rf t
+ git init t
Initialized empty Git repository in
C:/Users/Anthony/workspace/pre-commit/t/.git/
+ cd t
+ git remote add origin https://github.com/pre-commit/pre-commit-hooks
+ git config extensions.partialClone true
+ git fetch origin HEAD --quiet --filter=blob:none --tags
+ git checkout v4.4.0 -- .pre-commit-hooks.yaml
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (1/1), 1.73 KiB | 1.73 MiB/s, done.
error: unable to read sha1 file of .pre-commit-hooks.yaml
(f8523d4a677b2904df1ebf50c826323b2555edeb)
```

I can work around it by running `git show
v4.4.0:.pre-commit-hooks.yaml > /dev/null` before the checkout oddly
enough:

```console
>bash t.sh
+ rm -rf t
+ git init t
Initialized empty Git repository in
C:/Users/Anthony/workspace/pre-commit/t/.git/
+ cd t
+ git remote add origin https://github.com/pre-commit/pre-commit-hooks
+ git config extensions.partialClone true
+ git fetch origin HEAD --quiet --filter=blob:none --tags
+ git show v4.4.0:.pre-commit-hooks.yaml
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (1/1), 1.73 KiB | 1.73 MiB/s, done.
+ git checkout v4.4.0 -- .pre-commit-hooks.yaml
+ ls -al
total 20
drwxr-xr-x 1 Anthony 197609    0 May  2 09:50 .
drwxr-xr-x 1 Anthony 197609    0 May  2 09:50 ..
drwxr-xr-x 1 Anthony 197609    0 May  2 09:50 .git
-rw-r--r-- 1 Anthony 197609 6950 May  2 09:50 .pre-commit-hooks.yaml
```

anthony



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux