pico
created pr with
98.1
added 98.2
1: f8ad8c5 = 1: f8ad8c5 fix(rsync): delete largest path first
-: ------- > 2: 0d69224 chore: add tests
cmds
checkout latest patchset:
ssh pr.pico.sh print 98 | git am -3checkout any patchset in a patch request:
ssh pr.pico.sh print 98.[rev] | git am -3add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 98
Patchset
98.2
fix(rsync): delete largest path first
Eric Bower
2025-12-19T01:23:21ZSemantic diff summary
0 added,
1 modified,
0 signature changed,
0 removed
across 1 analyzed file
+8
-0
pkg/send/protocols/rsync/rsync.go
#
| ... | ... | @@ -153,6 +153,14 @@ func (h *handler) Remove(willReceive []*rsyncutils.ReceiverFile) error { | |
| 153 | 153 | } | |
| 154 | 154 | } | |
| 155 | 155 | ||
| 156 | + | // Sort by path depth descending so children are deleted before parents. | |
| 157 | + | // This ensures directories are empty before we try to remove them. | |
| 158 | + | slices.SortFunc(toDelete, func(a, b string) int { | |
| 159 | + | depthA := strings.Count(a, "/") | |
| 160 | + | depthB := strings.Count(b, "/") | |
| 161 | + | return depthB - depthA | |
| 162 | + | }) | |
| 163 | + | ||
| 156 | 164 | var errs []error | |
| 157 | 165 | ||
| 158 | 166 | for _, file := range toDelete { |