Skip to content

feat(files): skip excluded paths during copy operations - #2555

Merged
bajrangCoder merged 3 commits into
mainfrom
feat/file-copy-exclusions
Jul 31, 2026
Merged

feat(files): skip excluded paths during copy operations#2555
bajrangCoder merged 3 commits into
mainfrom
feat/file-copy-exclusions

Conversation

@bajrangCoder

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added enhancement New feature or request translations Anything related to Translations Whether a Issue or PR labels Jul 31, 2026
@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds configurable exclusion filtering to copy-and-paste operations.

  • Introduces a recursive copy helper that skips matching files and directories before preparing the destination.
  • Integrates exclusion-aware copying into the standalone file browser and sidebar folder operations.
  • Adds the setting, localization strings, path-matching utility, and focused unit coverage.

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported destination-deletion issue is fixed because copyEntry now returns for an excluded source before invoking the callback that can delete a conflicting destination, and focused coverage verifies that the callback is not called.

Important Files Changed

Filename Overview
src/utils/copyEntry.js Adds recursive, exclusion-aware copying and performs exclusion checks before invoking destination preparation callbacks.
src/utils/fileOperationExclusions.js Normalizes filesystem URLs and applies configured exclusion globs across local, remote, and SAF-style paths.
src/pages/fileBrowser/fileBrowser.js Delegates paste operations to the shared copy helper and places conflict deletion behind its pre-copy callback.
src/lib/openFolder.js Applies exclusion-aware copying to sidebar paste operations while retaining the native copy path when exclusions are disabled.
src/lib/settings.js Enables copy exclusions by default through the persisted settings store.
src/settings/appSettings.js Exposes the copy-exclusion toggle in the files and sessions settings category.
tests/unit/copyEntry.test.js Covers subtree pruning, disabled exclusions, and the ordering that prevents destination preparation for excluded sources.
tests/unit/fileOperationExclusions.test.js Covers directory, descendant, basename, Windows, remote, and SAF exclusion matching.

Sequence Diagram

sequenceDiagram
  participant Paste as Paste handler
  participant Copy as copyEntry
  participant Match as Exclusion matcher
  participant FS as fsOperation
  Paste->>Copy: Copy source into target directory
  Copy->>Match: Check source URL against patterns
  alt Source is excluded
    Match-->>Copy: Match
    Copy-->>Paste: skipped result
  else Source is included
    Match-->>Copy: No match
    Copy->>Paste: Run top-level pre-copy checks
    Paste-->>Copy: Continue
    Copy->>FS: Create file or directory
    loop Directory children
      Copy->>Copy: Recursively copy child
    end
    Copy-->>Paste: copied and skipped counts
  end
Loading

Reviews (2): Last reviewed commit: "fix the conflict case" | Re-trigger Greptile

Comment thread src/pages/fileBrowser/fileBrowser.js Outdated
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder
bajrangCoder added this pull request to the merge queue Jul 31, 2026
Merged via the queue into main with commit afe722e Jul 31, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Jul 31, 2026
@bajrangCoder
bajrangCoder deleted the feat/file-copy-exclusions branch July 31, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request translations Anything related to Translations Whether a Issue or PR

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant