Skip to content

Support jj for repo root checks#38

Merged
nialov merged 4 commits into
nialov:masterfrom
plumj-am:master
May 4, 2026
Merged

Support jj for repo root checks#38
nialov merged 4 commits into
nialov:masterfrom
plumj-am:master

Conversation

@plumj-am

Copy link
Copy Markdown
Contributor

Jujutsu (jj), if you are unfamiliar, is a git-compatible VCS: https://github.com/jj-vcs/jj

In jj worktrees I noticed I can't render workflows because they're independent from git unlike a lot of jj and get_git_toplevel() fails.

I've tested this in both git, jj, and git+jj scenarios and it works perfectly.

Signed-off-by: PlumJam <git@plumj.am>
@plumj-am

Copy link
Copy Markdown
Contributor Author

Sorry, I thought I ran the flake check. I'll fix it today.

Signed-off-by: PlumJam <git@plumj.am>
@nialov

nialov commented Apr 20, 2026

Copy link
Copy Markdown
Owner

I am a bit worried about the potential unwanted behavior here as I am unfamiliar with jj. get_repo_root now calls jj root first and as jj is added to runTimeInputs, it will always use jj. Will it always resolve the same as git rev-parse --show-toplevel?

I think this would be better handled by an explicit flake-parts option, such as flake.actions-nix.useJJ which enables usage of jj as input in runTimeInputs and by adding e.g. a flag to render-workflows. By default it would be false so no behavior is changed for users of actions.nix. I can provide some help to show spots where I think the code should be added if you have the time to revise?

@plumj-am

plumj-am commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

Yes, after looking into it a bit more, I see it's a bit flawed. Sorry about that! I'm working on a better solution as you described right now.

How I would do it:

  • add the option ciModule.options.useJJ
  • optional pkgs.jj for runtimeInputs based on the new option
  • pass useJJ through to the script via cmdLine.useJJ and then use it in the get_repo_root()

Would you add/change anything? Also, if useJJ is enabled, should it still fallback to git or should it be git OR jj only?

I'll add a bit more info about jj for you to clear some things up:

  • jj repos can be colocated with git repos (so they are backed by git) which means jj root and git rev-parse --show-top-level will share the same result
  • However, jj repos can also be standalone (some platforms support jj without git backing) which means git rev-parse --show-toplevel will fail but jj root will work fine
  • Most of the time, people use jj git init --colocate (which gives a jj repo backed by git) but it's worth keeping in mind that it's possible to use jj alone with some providers which could cause issues if we try to fallback to git

Signed-off-by: PlumJam <git@plumj.am>
Signed-off-by: PlumJam <git@plumj.am>
@nialov nialov merged commit 078688a into nialov:master May 4, 2026
1 check passed
@nialov

nialov commented May 4, 2026

Copy link
Copy Markdown
Owner

Thanks a lot and sorry for delay! Merged.

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.

2 participants