helix
helix copied to clipboard
Integration with Jujutsu
Jujutsu (or jj
) is a git compatible distributed version control system (DVCS). When working in a repository managed by Jujutsu, Helix will not display any gutter change indicators, as that functionality currently works with a standard git repository.
Support may be relatively simple, see https://github.com/martinvonz/jj/blob/main/docs/github.md#using-github-cli (using .jj/repo/store/git
)
Jujutsu is git compatible so it should be fine to simply rely on git functionality.
@archseer as far as I can tell it doesn't work out of the box, do you mean using the same mechanism but changing the detection of git repositories?
I just ran jj init --git-repo=.
on my existing repository. jj
is tracking changes in my working copy just fine. If I check git status
those changes are still unstaged and helix displays a diff.
@archseer that's a co-located jj repo, they retain the .git
folder AFAIK. If you jj git clone ...
or use something other than =.
the .git
isn't there and no changes are displayed as far as I can tell
For compatibility I'd recommend using a clone that contains the .git
folder. We're unlikely to add any other VCS any time soon (we don't even support Mercurial or Pijul so Jujutsu would be an even harder sell right now)
https://github.com/martinvonz/jj/blob/main/docs/git-compatibility.md#co-located-jujutsugit-repos
It's also useful when tools (e.g. build tools) expect a Git repo to be present.
To clarify I saw this with jj git clone
specifically
@archseer sure, this isn't a bug, it's an enhancement suggestion (full jj
support without co-locating)
Hmm since jj
does use a proper git store (.jj/repo/store/git
) it might be possible it could work by modifying the search path but I'm not sure if working changes would be detected properly.
\cc @pascalkuthe
For compatibility I'd recommend using a clone that contains the .git folder. We're unlikely to add any other VCS any time soon (we don't even support Mercurial or Pijul so Jujutsu would be an even harder sell right now)
@archseer Sorry, I'm on mobile and missed this!
I'm suggesting this since as you said it uses a proper git store, but I'd 100% completely understand if this isn't one of Helix's goals. Suggested specifically since I thought it might be a relatively painless and useful addition.
@archseer I may also be able to look into contributing this if it's something a newcomer to the codebase would be able to add / makes sense with the way it's currently implemented
We use gitoxide for repo discovery so the way to make this work in helix is to contribute that upstream. Altough we also use .git
for workspace root discovery so having a .git
folder present is likely a good idea anyway
Ok makes sense, thank you both @archseer @pascalkuthe!
Thanks for making an amazing editor!
on a separate note: jj
uses a different system for managing the working tree: https://github.com/martinvonz/jj#the-working-copy-is-automatically-committed, they always automatically commit the worktree. I am not sure how they handle the rev names here. Helix is currently hardcoded to always diff against HEAD. If jj
automatically makes the worktree HEAD, the diff gutter would be empty too. I would hope that they would just use a different ref name here tough.
Either way we want to add a config option to change which commit we diff against anyway so that could be fixed in the future if its a problem.
In Jujutsu, the working copy doesn't automatically become the HEAD
ref in Git -- it is committed separately, without affecting HEAD
. Only if you run something like jj commit
does HEAD
get updated.
A key difference between jj diff
and git diff
, though, is that jj
does not have the notion of untracked files.
% git init
% jj git init --git-repo . # creates a colocated jj repo
% touch a
% git status
(shows a as untracked)
% git diff
(nothing)
% jj status
(shows a as added)
% jj diff
(shows a)
There are also other differences, e.g. if you jj amend
, the change ID stays the same, but if you run git commit --amend
, a new change ID is assigned.
So while just relying on Git support is not the worst thing, integrating better with jj would be ideal.
(I use jj but not Helix, mostly offering this as help)
May be resolved by https://github.com/helix-editor/helix/pull/9643