Commit 298e76e
refactor(syncer): filter hidden directories before the IsRepo check
ListDirs used `strings.Index(f.Name(), ".") != 0` to drop hidden
entries — a slightly indirect way of asking the same question that
strings.HasPrefix asks more idiomatically. Switch to HasPrefix.
While here, reorder the filter chain so the cheap HasPrefix check
runs before IsRepo. IsRepo now performs an os.Stat per call, so
short-circuiting on hidden directories avoids a syscall for each
.something entry in the parent. Rewrite the conjunction as a
sequence of early-continue guards so the intent of each step reads
top-down.
Pure refactor — for non-empty names, "name starts with ." and
"strings.Index(name, \".\") == 0" are exactly the same predicate, so
ListDirs returns the same set of paths it always did.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f38ae87 commit 298e76e
1 file changed
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
19 | | - | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
21 | 31 | | |
22 | | - | |
23 | 32 | | |
24 | 33 | | |
25 | 34 | | |
| |||
0 commit comments