Skip to content

Fix the revision --version reports - #47

Open
BKPepe wants to merge 2 commits into
masterfrom
fix/build-revision
Open

BKPepe wants to merge 2 commits into
masterfrom
fix/build-revision

Conversation

@BKPepe

@BKPepe BKPepe commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Fix two issues with the revision --version reports:

  • Sources unpacked inside another git checkout no longer get that checkout's
    commit. git is asked only at the top of a work tree.
  • Cargo reruns the build script when HEAD or a branch moves, so the revision
    does not go stale. Any branch change now rebuilds the crate, and in a
    reftable any ref update does.

The git code moves to src/revision.rs, where the include list packages it, so
tests/revision.rs can build a small crate with it in temporary repositories:
the main checkout and a linked worktree, with refs in files and in a reftable,
through commits, amends, resets, branch switches and detached HEADs, and with
a shell stand-in for git before 2.31. A build with nothing changed does not
rerun the build script. The test does not run on Windows.

@BKPepe
BKPepe force-pushed the fix/build-revision branch from 7e6a614 to dbd3fda Compare November 20, 2026 13:36
@BKPepe BKPepe changed the title Take the revision in --version only from this checkout and keep it current Fix the revision --version reports Nov 20, 2026
Sources unpacked inside another git checkout got that checkout's commit. The
revision now comes from git only at the top of a work tree.
Cargo did not rerun the build script when HEAD moved. It now watches the files
git rewrites for that, which a test checks with refs in files and in a reftable.
@BKPepe
BKPepe force-pushed the fix/build-revision branch from dbd3fda to 55a7ca0 Compare November 20, 2026 17:03

This branch has not been deployed

No deployments
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