Skip to content

Diff against the repository, not target..target, on a bootstrap sync - #172

Merged
Bill Traynor (wmat) merged 1 commit into
mainfrom
fix/template-sync-bootstrap-shared-diff
Oct 5, 2026
Merged

Bill Traynor (wmat) merged 1 commit into
mainfrom
fix/template-sync-bootstrap-shared-diff

Conversation

@wmat

Copy link
Copy Markdown
Collaborator

The shared-files checklist tells a maintainer which files UPGRADING.md
sections 2.5/2.6 oblige them to merge by hand. On a bootstrap run it
reports nothing, every time.

When no .template-version exists, "Determine baseline and target" sets
baseline to target, because there is no record of what this repository
was last synced from. "Report shared files that need a manual merge"
then runs git diff --quiet "$baseline" "$target", comparing a commit
with itself. It finds nothing for any path, so the PR body renders:

- No shared files changed upstream in this range.

That is true and useless. The range is empty by construction, and the
line reads as reassurance on exactly the run where the manual merge
burden is largest -- the first one, where the repository has never been
reconciled with the template at all.

Measured on riscv/riscv-high-assurance-cryptography, whose first sync is
a bootstrap: 11 of the 12 shared paths diverge from the template,
including src/ by ~18800 lines, README.adoc by 306 and Makefile by
199. The checklist reported none of them.

Pick the diff base from the bootstrap flag. With no baseline to speak
of, compare the repository's own tree against the target -- the question
a first sync should answer is how far this repo has drifted from the
template it was created from, not what changed in an empty range. HEAD
is the pre-sync commit at that point: "Create branch" only switched
branches and the copy step staged without committing. Subsequent runs,
which do have a real baseline, keep the existing upstream-delta
behaviour and wording unchanged.

On the repository above the patched step now flags those 11 paths and
still correctly omits .gitmodules, which is byte-identical.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Signed-off-by: Bill Traynor wmat@riscv.org

The shared-files checklist tells a maintainer which files UPGRADING.md
sections 2.5/2.6 oblige them to merge by hand. On a bootstrap run it
reports nothing, every time.

When no `.template-version` exists, "Determine baseline and target" sets
baseline to target, because there is no record of what this repository
was last synced from. "Report shared files that need a manual merge"
then runs `git diff --quiet "$baseline" "$target"`, comparing a commit
with itself. It finds nothing for any path, so the PR body renders:

    - No shared files changed upstream in this range.

That is true and useless. The range is empty by construction, and the
line reads as reassurance on exactly the run where the manual merge
burden is largest -- the first one, where the repository has never been
reconciled with the template at all.

Measured on riscv/riscv-high-assurance-cryptography, whose first sync is
a bootstrap: 11 of the 12 shared paths diverge from the template,
including `src/` by ~18800 lines, `README.adoc` by 306 and `Makefile` by
199. The checklist reported none of them.

Pick the diff base from the bootstrap flag. With no baseline to speak
of, compare the repository's own tree against the target -- the question
a first sync should answer is how far this repo has drifted from the
template it was created from, not what changed in an empty range. HEAD
is the pre-sync commit at that point: "Create branch" only switched
branches and the copy step staged without committing. Subsequent runs,
which do have a real baseline, keep the existing upstream-delta
behaviour and wording unchanged.

On the repository above the patched step now flags those 11 paths and
still correctly omits `.gitmodules`, which is byte-identical.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Bill Traynor <wmat@riscv.org>
@wmat
Bill Traynor (wmat) merged commit e20270a into main Oct 5, 2026
11 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.

1 participant