Commit 22444da
mingw: lstat: compute correct size for symlinks
This commit fixes mingw_lstat by computing the proper size for symlinks
according to POSIX. POSIX specifies that upon successful return from
lstat: "the value of the st_size member shall be set to the length of
the pathname contained in the symbolic link not including any
terminating null byte".
Prior to this commit the mingw_lstat function returned a fixed size of
4096. This caused problems in git repositories that were accessed by
git for Cygwin or git for WSL. For example, doing `git reset --hard`
using git for Windows would update the size of symlinks in the index
to be 4096; at a later time git for Cygwin or git for WSL would find
that symlinks have changed size during `git status`. Vice versa doing
`git reset --hard` in git for Cygwin or git for WSL would update the
size of symlinks in the index with the correct value, only for git for
Windows to find incorrectly at a later time that the size had changed.
Signed-off-by: Bill Zissimopoulos <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>1 parent bbdff29 commit 22444da
2 files changed
+56
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
962 | 962 | | |
963 | 963 | | |
964 | 964 | | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
965 | 968 | | |
966 | 969 | | |
967 | 970 | | |
968 | | - | |
| 971 | + | |
| 972 | + | |
969 | 973 | | |
970 | 974 | | |
971 | 975 | | |
| |||
980 | 984 | | |
981 | 985 | | |
982 | 986 | | |
983 | | - | |
| 987 | + | |
984 | 988 | | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
989 | 994 | | |
990 | 995 | | |
991 | 996 | | |
992 | 997 | | |
993 | 998 | | |
994 | 999 | | |
995 | | - | |
996 | | - | |
| 1000 | + | |
| 1001 | + | |
997 | 1002 | | |
998 | 1003 | | |
999 | 1004 | | |
1000 | 1005 | | |
1001 | 1006 | | |
1002 | 1007 | | |
1003 | 1008 | | |
1004 | | - | |
| 1009 | + | |
1005 | 1010 | | |
1006 | 1011 | | |
1007 | 1012 | | |
| |||
2938 | 2943 | | |
2939 | 2944 | | |
2940 | 2945 | | |
2941 | | - | |
| 2946 | + | |
| 2947 | + | |
2942 | 2948 | | |
2943 | 2949 | | |
2944 | | - | |
| 2950 | + | |
2945 | 2951 | | |
2946 | 2952 | | |
2947 | | - | |
2948 | | - | |
2949 | | - | |
2950 | | - | |
2951 | | - | |
2952 | 2953 | | |
2953 | 2954 | | |
2954 | 2955 | | |
| |||
2968 | 2969 | | |
2969 | 2970 | | |
2970 | 2971 | | |
2971 | | - | |
| 2972 | + | |
2972 | 2973 | | |
2973 | 2974 | | |
2974 | 2975 | | |
| |||
2982 | 2983 | | |
2983 | 2984 | | |
2984 | 2985 | | |
2985 | | - | |
2986 | | - | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
2987 | 2993 | | |
2988 | 2994 | | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
2989 | 3014 | | |
2990 | 3015 | | |
2991 | 3016 | | |
2992 | 3017 | | |
2993 | 3018 | | |
2994 | 3019 | | |
2995 | 3020 | | |
2996 | | - | |
2997 | | - | |
2998 | 3021 | | |
2999 | 3022 | | |
3000 | 3023 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
587 | 599 | | |
588 | 600 | | |
589 | 601 | | |
| |||
0 commit comments