Skip to content

fix(targethasher): frame directory hashes for BUG-007 - #301

Merged
sbalabanov merged 1 commit into
mainfrom
sbalabanov/bug-007
Aug 27, 2026
Merged

fix(targethasher): frame directory hashes for BUG-007#301
sbalabanov merged 1 commit into
mainfrom
sbalabanov/bug-007

Conversation

@sbalabanov

@sbalabanov sbalabanov commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

BUG-007 fixes directory hashes for edge cases that file contents alone miss:

  • A file, directory, or symlink rename changes the hash.
  • Directory nesting and empty directories change the hash.
  • Adding a symlink or changing its target changes the hash.
  • Creation order does not change the hash.

The implementation streams filepath.WalkDir in lexical order and hashes each entry's local name, kind, and file contents or symlink target. It does not hash checkout paths or filesystem mode bits, so the result stays stable across machines.

Tests

Added coverage for rename, directory structure, symlinks, creation order, and mode independence.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sbalabanov
sbalabanov marked this pull request as ready for review August 26, 2026 18:32
@sbalabanov
sbalabanov requested review from a team as code owners August 26, 2026 18:32
@sbalabanov
sbalabanov marked this pull request as draft August 26, 2026 19:17
Comment thread core/targethasher/sourcehasher.go Outdated
Comment thread core/targethasher/sourcehasher.go Outdated
Comment thread core/targethasher/sourcehasher.go Outdated
Comment thread core/targethasher/sourcehasher.go Outdated
Comment thread core/targethasher/sourcehasher.go Outdated
Comment thread core/targethasher/sourcehasher.go Outdated
Comment thread core/targethasher/sourcehasher.go Outdated
@sbalabanov
sbalabanov force-pushed the sbalabanov/bug-007 branch 2 times, most recently from d561d1d to 91e1319 Compare August 26, 2026 22:33
Comment thread core/targethasher/sourcehasher.go
@sbalabanov
sbalabanov marked this pull request as ready for review August 26, 2026 22:36
@sbalabanov
sbalabanov marked this pull request as draft August 26, 2026 22:36

@sbalabanov sbalabanov left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update PR description to correctly represent changes on the last version vs base revision. Make accent on edge cases it aims to address. Shorten. Use simple language.

@sbalabanov
sbalabanov marked this pull request as ready for review August 26, 2026 22:47
@sbalabanov
sbalabanov marked this pull request as draft August 26, 2026 22:49
@sbalabanov

Copy link
Copy Markdown
Contributor Author

Updated the BUG-007 commit message and PR description in fd67123 to match the current two-file diff. The shorter text now highlights directory renames and structure, symlink target changes, deterministic streaming traversal, and the exclusion of checkout paths and mode bits. No code changed.

[addressed by agent]

@sbalabanov
sbalabanov marked this pull request as ready for review August 26, 2026 22:55
@sbalabanov
sbalabanov marked this pull request as draft August 26, 2026 23:19
@sbalabanov
sbalabanov marked this pull request as ready for review August 26, 2026 23:33
Comment thread core/targethasher/sourcehasher.go
BUG-007 fixes directory hashes for edge cases that file contents alone miss.

- Detect file, directory, and symlink renames, changed directory structure, empty directories, and symlink target changes.
- Stream filepath.WalkDir in lexical order, so creation order does not matter and the whole tree is not buffered.
- Hash local entry names and platform-neutral kinds with file contents or symlink targets.
- Omit checkout paths and filesystem mode bits so hashes stay stable across machines.

Tests cover rename, structure, symlinks, creation order, and mode independence.
@sbalabanov
sbalabanov merged commit f7e7bda into main Aug 27, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants