Skip to content

Commit d053db3

Browse files
codexByron
authored andcommitted
fixup! feat: add Git-aware dua clean subcommand
Simplify clean refresh and candidate bookkeeping (change `wtrtlqx`). - Resolve clean refresh targets directly, preserving whole-candidate Git revalidation and the ignore-pattern scope of their original discovery root. - Share filesystem path construction and candidate-provenance removal with traversal code, and reuse ignore-pattern rebasing during discovery and sizing. - Remove redundant root total updates before cleanup grouping. Validation: `cargo test --offline clean_`, `cargo test --offline --bin dua`, `cargo fmt --all --check`, and `git diff --check`. Diff-stat: 160 insertions, 221 deletions (61 fewer lines). # d773114 fixup! feat: update deletion progress without blocking navigation fixup! feat: update deletion progress without blocking navigation Give `dua clean` a dedicated hub for discovering and grouping deletion candidates. This follows change `nokwszk` so deletion progress can use the same flat, stable candidate roots while the user navigates between the hub and the browser. - Title the hub with its search inputs, group siblings and contained candidates, and preserve the selected path as candidates arrive, disappear, or leave a singleton. Keep the hub in largest-first order with its own limited controls. - Open a candidate or group at a detached browser root backed by existing real nodes. Reuse ordinary sorting, glob search, Gitignore annotations, navigation, marking, and deletion without copying or reparenting candidate trees. - Keep group membership, group marking, labels, and refresh policy in `CleanHub`. Remove group metadata and action-specific clean branches from ordinary entries, widgets, and handlers. The explicit hub adds code but reduces browser coupling. - Preserve whole-candidate Git revalidation and original ignore-pattern scope on refresh. Restore the original search directory before replaying a glob, and keep navigation inside the scoped results when their viewed entry is deleted. - Clear browser rows and annotation messages when returning to the hub, so deletion cannot consult removed entries after leaving the browser. Validation: - Clean journeys cover input titles, grouping, scoped browsing/search, Gitignore annotations, refresh provenance, selection, and deletion safety. - `make check-pre-push` - `cargo clippy --offline --workspace --all-targets --all-features -- -D warnings` - Linux and Windows workspace compilation with all targets and features. - Independent review of scoped navigation, refresh, and deletion. Codex CLI review remains unavailable because of expired authentication and a reported usage limit. # df12220 fixup! fixup! feat: update deletion progress without blocking navigation fixup! fixup! feat: update deletion progress without blocking navigation Reduce the UI adaptation introduced in change `mzunukt` while keeping cleanup grouping separate from ordinary interactive browsing. - Render borrowed entry rows with presentation flags and an optional label. The shared widget consumes an iterator and a selected row position; it no longer needs filesystem indices or the application's mark and annotation maps. - Remove the hub's cloned entry bundles, temporary maps, and fake row indices. Use the usual directory marker before appending a group label. - Share path opening, deletion guards, and opener errors between the hub and browser. Keep the distinct partial-group marking rule inside `CleanHub`. - Simplify hub state access without adding clean-specific branches to ordinary browser handlers or changing traversal and deletion scopes. Validation: - `cargo test --offline --all-features --bin dua --quiet` - `cargo clippy --offline --workspace --all-targets --all-features -- -D warnings` - Regression assertions for fully and partially marked group rendering. - Independent review of rendering, navigation, group marks, and deletion guards.
1 parent 4f20ea9 commit d053db3

27 files changed

Lines changed: 1224 additions & 1001 deletions

‎README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ LANG=zh_CN.UTF-8 dua i # Simplified Chinese interface
257257

258258
### Cleanup Mode
259259

260-
`dua clean [DIRECTORY]...` searches for disposable directories and opens the same interactive
261-
interface. Multiple candidates with the same parent are grouped under that parent, which also
262-
contains any deeper candidates beneath it. These virtual groups show only cleanup candidates;
263-
marking a group marks its candidates, leaving the parent and other contents untouched. Single
264-
candidates without a containing group stay as separate roots. With no paths, it searches the
265-
current directory.
260+
`dua clean [DIRECTORY]...` lists disposable directories in a hub titled with the search inputs,
261+
largest first, without sorting controls or glob search. Siblings are grouped under their parent,
262+
including any deeper candidates beneath it; other candidates stay separate. Opening a group
263+
shows its candidates in the normal interactive interface, with sorting and glob search scoped
264+
to that group. Going back returns to the hub. Marking a group marks only its candidates,
265+
leaving the parent and other contents untouched. With no paths, it searches the current directory.
266266
Discovery reads directory entries without file-size metadata, prunes candidates from further
267267
search, and sizes each candidate completely before listing it. Candidates share the sizing workers
268268
and appear as each finishes, allowing faster scans to overtake slower ones within the configured

‎src/clean.rs‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ fn is_excluded(path: &Path, root: &Path, cwd: &Path, options: &crate::WalkOption
217217
.iter()
218218
.any(|ignored| path.starts_with(ignored))
219219
|| options.ignore_patterns.as_ref().is_some_and(|patterns| {
220-
path.strip_prefix(cwd)
221-
.or_else(|_| path.strip_prefix(root))
222-
.is_ok_and(|relative| patterns.is_excluded(relative, true))
220+
crate::pattern_relative_path(path, cwd, root)
221+
.is_some_and(|relative| patterns.is_excluded(relative, true))
223222
})
224223
}
225224

‎src/common.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ pub fn canonicalize_ignore_dirs(ignore_dirs: &[PathBuf]) -> BTreeSet<PathBuf> {
410410
/// the directory it was given, if it was given exactly one - so that is what patterns should see.
411411
/// Roots outside via `traversal_root` of the current directory have no such path, and fall back to
412412
/// being relative to the root they were found under.
413-
fn pattern_relative_path<'a>(
413+
pub(crate) fn pattern_relative_path<'a>(
414414
path: &'a Path,
415415
cwd: &Path,
416416
traversal_root: &Path,

0 commit comments

Comments
 (0)