Repository navigation
SC-4: file enumeration and recursive directory traversal engine - #2
Merged
Merged
Conversation
iampryce
commented
Jul 31, 2026
Contributor
- sync.Walk: recursive traversal via filepath.WalkDir
- FileEntry metadata (path, size, mtime, mode, uid/gid, symlink target)
- Symlinks captured via Lstat, never followed
- Deterministic path-sorted output
- -r/-d flag semantics wired into CLI
- Cross-platform UID/GID handling (build-tag split, Windows returns 0)
- .gitattributes fixing CRLF/gofmt friction
- README updated: file enumeration section, flag table, platform caveat
- sync.Walk: recursive traversal via filepath.WalkDir - FileEntry metadata (path, size, mtime, mode, uid/gid, symlink target) - Symlinks captured via Lstat, never followed - Deterministic path-sorted output - -r/-d flag semantics wired into CLI - Cross-platform UID/GID handling (build-tag split, Windows returns 0) - .gitattributes fixing CRLF/gofmt friction - README updated: file enumeration section, flag table, platform caveat
There was a problem hiding this comment.
Pull request overview
This PR adds the initial file-enumeration (“flist”) engine to internal/sync, including recursive directory traversal and richer per-entry metadata, and wires the -d/--dirs flag into the CLI flag parser. It also updates the README to document enumeration behavior and adds .gitattributes to normalize LF endings.
Changes:
- Implement
internal/sync.Walk(filepath-based recursive traversal) returning deterministic path-sorted[]FileEntrywith metadata (mode, mtime, size, uid/gid, symlink target). - Add unit tests covering recursion/dirs semantics, symlink behavior, and deterministic ordering.
- Wire
--dirs/-dinto CLI parsing and update README documentation accordingly; add.gitattributesfor LF normalization.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates project status and documents new file-enumeration behavior and -r/-d semantics. |
| internal/sync/walk.go | Introduces the traversal + metadata collection implementation and deterministic sorting. |
| internal/sync/walk_test.go | Adds tests for traversal depth rules, symlink handling, file sizes, and ordering. |
| internal/sync/uidgid_unix.go | Adds POSIX UID/GID extraction via syscall.Stat_t behind build tags. |
| internal/sync/uidgid_windows.go | Adds Windows stub returning “unavailable” ownership metadata. |
| internal/cli/root.go | Adds --dirs/-d flag and prints it in the CLI echo output. |
| .gitattributes | Forces LF line endings to reduce CRLF/gofmt friction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+93
to
+97
| // lookupUIDGID is platform-specific (see uidgid_unix.go / | ||
| // uidgid_windows.go): on Windows it always reports unavailable, | ||
| // leaving UID/GID at their zero value. That zero must not be read | ||
| // as "owned by root" — see uidgid_windows.go for why. | ||
| entry.UID, entry.GID, _ = lookupUIDGID(info) |
Comment on lines
+53
to
+55
| `internal/sync.Walk` recursively lists a source tree into a sorted | ||
| `[]FileEntry` (path, size, mtime, mode, uid/gid, symlink target). Symlinks | ||
| are captured via `Lstat`, never followed. |
…README syntax FileEntry now carries OwnershipAvailable so a real uid/gid of 0 can't be confused with "ownership unavailable" on Windows. Also fixes an invalid internal/sync.Walk package-selector reference in the README.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.