Commit f840f02
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 7f7969a commit f840f02
2 files changed
+56
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
988 | 988 | | |
989 | 989 | | |
990 | 990 | | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
991 | 994 | | |
992 | 995 | | |
993 | 996 | | |
994 | | - | |
| 997 | + | |
| 998 | + | |
995 | 999 | | |
996 | 1000 | | |
997 | 1001 | | |
| |||
1006 | 1010 | | |
1007 | 1011 | | |
1008 | 1012 | | |
1009 | | - | |
| 1013 | + | |
1010 | 1014 | | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
1015 | 1020 | | |
1016 | 1021 | | |
1017 | 1022 | | |
1018 | 1023 | | |
1019 | 1024 | | |
1020 | 1025 | | |
1021 | | - | |
1022 | | - | |
| 1026 | + | |
| 1027 | + | |
1023 | 1028 | | |
1024 | 1029 | | |
1025 | 1030 | | |
1026 | 1031 | | |
1027 | 1032 | | |
1028 | 1033 | | |
1029 | 1034 | | |
1030 | | - | |
| 1035 | + | |
1031 | 1036 | | |
1032 | 1037 | | |
1033 | 1038 | | |
| |||
3002 | 3007 | | |
3003 | 3008 | | |
3004 | 3009 | | |
3005 | | - | |
| 3010 | + | |
| 3011 | + | |
3006 | 3012 | | |
3007 | 3013 | | |
3008 | | - | |
| 3014 | + | |
3009 | 3015 | | |
3010 | 3016 | | |
3011 | | - | |
3012 | | - | |
3013 | | - | |
3014 | | - | |
3015 | | - | |
3016 | 3017 | | |
3017 | 3018 | | |
3018 | 3019 | | |
| |||
3032 | 3033 | | |
3033 | 3034 | | |
3034 | 3035 | | |
3035 | | - | |
| 3036 | + | |
3036 | 3037 | | |
3037 | 3038 | | |
3038 | 3039 | | |
| |||
3046 | 3047 | | |
3047 | 3048 | | |
3048 | 3049 | | |
3049 | | - | |
3050 | | - | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
3051 | 3057 | | |
3052 | 3058 | | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
3053 | 3078 | | |
3054 | 3079 | | |
3055 | 3080 | | |
3056 | 3081 | | |
3057 | 3082 | | |
3058 | 3083 | | |
3059 | 3084 | | |
3060 | | - | |
3061 | | - | |
3062 | 3085 | | |
3063 | 3086 | | |
3064 | 3087 | | |
| |||
| 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