Commit 18d6c79
committed
bug: fix contents_first with root symlink
This fixes two incorrect behaviors when `contents_first` is on and the
root path is a symlink:
1. The root path was returned first in the iterator instead of last.
2. Some subdirectories were returned out of order.
The issue was that root symlinks were returned immediately rather than
being pushed onto the `deferred_dirs` vec. That lead to `deferred_dirs`
and `depth` being out of sync, which lead to deferred directories being
processed one ascent too late.
This also changes the internal handling of the `same_file_system` option
slightly. Previously, if a directory was found to be on a different file
system it would _not_ be pushed to the stack, but it _would_ be pushed
to the deferred list. This did not matter because in those cases
`handle_entry()` would return to `next()`, which would immediately pop
the directory off the deferred list and return it. This ensures that the
directory is returned immediately, and is not pushed to either the stack
or the deferred list. (I think this makes the code clearer.)
Fixes: #1631 parent 61a185f commit 18d6c79
2 files changed
Lines changed: 59 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
821 | 821 | | |
822 | 822 | | |
823 | 823 | | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
829 | 833 | | |
830 | 834 | | |
831 | | - | |
| 835 | + | |
832 | 836 | | |
833 | | - | |
| 837 | + | |
834 | 838 | | |
835 | 839 | | |
836 | 840 | | |
| |||
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
844 | | - | |
845 | | - | |
846 | | - | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
847 | 854 | | |
848 | | - | |
| 855 | + | |
849 | 856 | | |
850 | 857 | | |
851 | 858 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1021 | 1021 | | |
1022 | 1022 | | |
1023 | 1023 | | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
0 commit comments