Skip to content

Conversation

ipetkov
Copy link
Contributor

@ipetkov ipetkov commented Aug 16, 2025

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes

@ipetkov ipetkov requested a review from a team as a code owner August 16, 2025 19:05
@ipetkov
Copy link
Contributor Author

ipetkov commented Aug 16, 2025

Hmm test suite passed for me on the initial run, but now that I have this merged into another branch I see the test_global_opts::test_version failing consistently 🤔

thread 'test_global_opts::test_version' (3658728) panicked at cli/tests/test_global_opts.rs:61:5:
    `jj version` output: "jj 0.32.0-dirty\n".
    Sanitized: "jj ?.??.?-?irty\n"
    Expected one of: ["jj ?.??.?\n", "jj ?.??.?-????????????????????????????????????????\n"]
    stack backtrace:
       0: __rustc::rust_begin_unwind
       1: core::panicking::panic_fmt
       2: runner::test_global_opts::test_version
       3: runner::test_global_opts::test_version::{{closure}}
       4: core::ops::function::FnOnce::call_once
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@ipetkov
Copy link
Contributor Author

ipetkov commented Aug 16, 2025

Maybe another option to hardcoding NIX_JJ_GIT_HASH = self.rev or "dirty"; would be to change it to NIX_JJ_GIT_HASH = self.rev or ""; in the devshell, and then tweak the build script to not ignore when $NIX_JJ_GIT_HASH is set but empty? Not fully sure the implications of doing that (would this break version output for Nix builds?) so I could use a pointer on whether there's a preferable way to resolve this or just live with the spurious rebuilds and close this PR

Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

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

cc @thoughtpolice as I have no expertise on the nix part.

@ipetkov ipetkov force-pushed the ivan/push-tvppvspulrvn branch 2 times, most recently from 7d7a4c9 to fd5daa0 Compare August 20, 2025 19:23
@ipetkov ipetkov requested review from thoughtpolice and yuja August 20, 2025 19:32
Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

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

The changes in build.rs look good. I can't review the nix change, so I'll leave it to someone else.

@ipetkov ipetkov force-pushed the ivan/push-tvppvspulrvn branch from fd5daa0 to 396fd95 Compare August 22, 2025 22:03
@martinvonz
Copy link
Member

The changes in build.rs look good. I can't review the nix change, so I'll leave it to someone else.

Maybe @thoughtpolice or @emilazy can help?

@ipetkov ipetkov force-pushed the ivan/push-tvppvspulrvn branch from 396fd95 to 6052d9e Compare September 1, 2025 01:25
@ipetkov
Copy link
Contributor Author

ipetkov commented Sep 1, 2025

Hmm test suite passed for me on the initial run, but now that I have this merged into another branch I see the test_global_opts::test_version failing consistently 🤔

Ended up adding an allowance for version strings ending with a -dirty suffix for debug builds, please let me know if this is not something we want to have!

@ipetkov ipetkov force-pushed the ivan/push-tvppvspulrvn branch from 67310d1 to 10693ae Compare September 2, 2025 17:16
The build script has a hierarchy of where the current git hash is
detected from: check $NIX_JJ_GIT_HASH, if that fails, ask jj, if that
fails, ask git.

If the build script is satisfied from a query higher up the priority
chain, there's no reason to instruct cargo to rereun and rebuild (and
relink) everything: for example if $NIX_JJ_GIT_HASH is set, there's no
need to check heads from either jj or git.

Although the build script takes effort to specify `jj log
--ignore-working-copy`, it would previously still get invalidated if jj
performed a snapshot (even if $NIX_JJ_GIT_HASH was set). This can be
fairly annoying when iterating on the test suite where each commit would
rebuild the CLI and by extension all of its tests.
@ipetkov ipetkov force-pushed the ivan/push-tvppvspulrvn branch from 10693ae to 207381f Compare September 24, 2025 00:23
@ipetkov
Copy link
Contributor Author

ipetkov commented Sep 24, 2025

The changes in build.rs look good. I can't review the nix change, so I'll leave it to someone else.

I've dropped the Nix specific changes from this PR, I'm just as happy hard-coding export NIX_JJ_GIT_HASH=dirty in my .envrc which does what I want (avoiding unnecessary rebuilds when I amend commits).

With that said, @yuja do you feel comfortable approving the rest of the build.rs changes?

@ipetkov ipetkov requested a review from yuja September 24, 2025 00:26
Copy link
Contributor

@yuja yuja left a comment

Choose a reason for hiding this comment

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

I don't know how nix sets -?irty suffix, the other changes look good, thanks.

@ipetkov ipetkov force-pushed the ivan/push-tvppvspulrvn branch from 207381f to 6dbbb0a Compare September 24, 2025 22:59
@ipetkov ipetkov added this pull request to the merge queue Sep 24, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 24, 2025
@ipetkov ipetkov added this pull request to the merge queue Sep 25, 2025
Merged via the queue into main with commit 736f9bb Sep 25, 2025
69 of 77 checks passed
@ipetkov ipetkov deleted the ivan/push-tvppvspulrvn branch September 25, 2025 05:22
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.

5 participants