Skip to content

Fix conflict on changing dependencies (#96)#98

Merged
jhidding merged 1 commit into
entangled:mainfrom
v1kko:fix/96-changing-dependencies
Jun 8, 2026
Merged

Fix conflict on changing dependencies (#96)#98
jhidding merged 1 commit into
entangled:mainfrom
v1kko:fix/96-changing-dependencies

Conversation

@v1kko

@v1kko v1kko commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #96. Write.conflict had a redundant "newer than all of its sources" mtime heuristic that ran only after the filedb hash check already confirmed the file was unmodified externally — so it could only ever produce false positives. When a target stops depending on a former source, its content changes while the remaining sources look "older", wrongly triggering a conflict. The fix drops the heuristic and relies on the filedb hash comparison (as @jhidding suggested), which still fully protects hand-edited generated files. Adds regression test test_changing_dependencies.

When a target file no longer depends on one of its former source files,
its content changes while the remaining sources are all older than the
target. The mtime-based "newer than all of its sources" heuristic in
Write.conflict then wrongly reported a conflict.

That heuristic is only reached after the filedb hash check has already
confirmed the file on disk is exactly what Entangled last wrote (i.e. it
was not edited outside of Entangled), so it could only ever produce false
positives. Drop it and rely on the filedb comparison, which is the
reliable way to detect external edits.

Adds a regression test for the dependency-graph change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jhidding jhidding merged commit b6ff072 into entangled:main Jun 8, 2026
6 checks passed
@jhidding

jhidding commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Thanks! That was much simpler than I thought, I guess I was on the paranoid side of things 😂

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.

Error on changing dependencies

2 participants