Commit 170899a
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 <billziss@navimatics.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent 4e7d782 commit 170899a
2 files changed
+56
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
820 | 823 | | |
821 | 824 | | |
822 | 825 | | |
823 | | - | |
| 826 | + | |
| 827 | + | |
824 | 828 | | |
825 | 829 | | |
826 | 830 | | |
| |||
835 | 839 | | |
836 | 840 | | |
837 | 841 | | |
838 | | - | |
| 842 | + | |
839 | 843 | | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
844 | 849 | | |
845 | 850 | | |
846 | 851 | | |
847 | 852 | | |
848 | 853 | | |
849 | 854 | | |
850 | | - | |
851 | | - | |
| 855 | + | |
| 856 | + | |
852 | 857 | | |
853 | 858 | | |
854 | 859 | | |
855 | 860 | | |
856 | 861 | | |
857 | 862 | | |
858 | 863 | | |
859 | | - | |
| 864 | + | |
860 | 865 | | |
861 | 866 | | |
862 | 867 | | |
| |||
2698 | 2703 | | |
2699 | 2704 | | |
2700 | 2705 | | |
2701 | | - | |
| 2706 | + | |
| 2707 | + | |
2702 | 2708 | | |
2703 | 2709 | | |
2704 | | - | |
| 2710 | + | |
2705 | 2711 | | |
2706 | 2712 | | |
2707 | | - | |
2708 | | - | |
2709 | | - | |
2710 | | - | |
2711 | | - | |
2712 | 2713 | | |
2713 | 2714 | | |
2714 | 2715 | | |
| |||
2728 | 2729 | | |
2729 | 2730 | | |
2730 | 2731 | | |
2731 | | - | |
| 2732 | + | |
2732 | 2733 | | |
2733 | 2734 | | |
2734 | 2735 | | |
| |||
2742 | 2743 | | |
2743 | 2744 | | |
2744 | 2745 | | |
2745 | | - | |
2746 | | - | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
2747 | 2753 | | |
2748 | 2754 | | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
2749 | 2774 | | |
2750 | 2775 | | |
2751 | 2776 | | |
2752 | 2777 | | |
2753 | 2778 | | |
2754 | 2779 | | |
2755 | 2780 | | |
2756 | | - | |
2757 | | - | |
2758 | 2781 | | |
2759 | 2782 | | |
2760 | 2783 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
585 | 597 | | |
586 | 598 | | |
587 | 599 | | |
| |||
0 commit comments