Commit 937ada6
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 7ea8604 commit 937ada6
2 files changed
+56
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
963 | 963 | | |
964 | 964 | | |
965 | 965 | | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
966 | 969 | | |
967 | 970 | | |
968 | 971 | | |
969 | | - | |
| 972 | + | |
| 973 | + | |
970 | 974 | | |
971 | 975 | | |
972 | 976 | | |
| |||
981 | 985 | | |
982 | 986 | | |
983 | 987 | | |
984 | | - | |
| 988 | + | |
985 | 989 | | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
990 | 995 | | |
991 | 996 | | |
992 | 997 | | |
993 | 998 | | |
994 | 999 | | |
995 | 1000 | | |
996 | | - | |
997 | | - | |
| 1001 | + | |
| 1002 | + | |
998 | 1003 | | |
999 | 1004 | | |
1000 | 1005 | | |
1001 | 1006 | | |
1002 | 1007 | | |
1003 | 1008 | | |
1004 | 1009 | | |
1005 | | - | |
| 1010 | + | |
1006 | 1011 | | |
1007 | 1012 | | |
1008 | 1013 | | |
| |||
2967 | 2972 | | |
2968 | 2973 | | |
2969 | 2974 | | |
2970 | | - | |
| 2975 | + | |
| 2976 | + | |
2971 | 2977 | | |
2972 | 2978 | | |
2973 | | - | |
| 2979 | + | |
2974 | 2980 | | |
2975 | 2981 | | |
2976 | | - | |
2977 | | - | |
2978 | | - | |
2979 | | - | |
2980 | | - | |
2981 | 2982 | | |
2982 | 2983 | | |
2983 | 2984 | | |
| |||
2997 | 2998 | | |
2998 | 2999 | | |
2999 | 3000 | | |
3000 | | - | |
| 3001 | + | |
3001 | 3002 | | |
3002 | 3003 | | |
3003 | 3004 | | |
| |||
3011 | 3012 | | |
3012 | 3013 | | |
3013 | 3014 | | |
3014 | | - | |
3015 | | - | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
3016 | 3022 | | |
3017 | 3023 | | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
3018 | 3043 | | |
3019 | 3044 | | |
3020 | 3045 | | |
3021 | 3046 | | |
3022 | 3047 | | |
3023 | 3048 | | |
3024 | 3049 | | |
3025 | | - | |
3026 | | - | |
3027 | 3050 | | |
3028 | 3051 | | |
3029 | 3052 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
597 | 609 | | |
598 | 610 | | |
599 | 611 | | |
| |||
0 commit comments