Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
`jj` can not push to radicle
Open did:key:z6MkwfcG...bzQA opened 1 year ago crate=radicle-remote-helper type=improvement

jj is a really nice version control system that uses git in the background. As such it can fetch data from radicle, but jj git push fails.

jj complains about “unfamiliar output”. It apparently tries to parse some output returned by git push procelain and git-remote-rad seems to be messing up the expected output.

This is what a sequence of commands that create a “refs/patches” “branch” in jj and then pushes that into the git remote that lives in origin:

> jj bookmark create refs/patches -r @
Created 1 bookmarks pointing to zvrlxmuo db790658 refs/patches | Add `rad-patch` config snippet into `README.md`
> jj git push -r @ --remote origin --allow-new
Changes to push to origin:
  Add bookmark refs/patches to db7906586ea8
Error: Git process failed: Git push output unfamiliar:

Error: External command exited with 1

The code producing this output is in the parse_ref_pushes in git_subprocess.rs in the jj repo (https://github.com/jj-vcs/jj.git for your convenience).

It apparently expects the output to start with b"To ". The docs to the function says this to the expected format:

// git-push porcelain has the following format (per line)
// `<flag>\t<from>:<to>\t<summary> (<reason>)`
//
// <flag> is one of:
//     ' ' for a successfully pushed fast-forward;
//      + for a successful forced update
//      - for a successfully deleted ref
//      * for a successfully pushed new ref
//      !  for a ref that was rejected or failed to push; and
//      =  for a ref that was up to date and did not need pushing.
//
// <from>:<to> is the refspec
//
// <summary> is extra info (commit ranges or reason for rejected)
//
// <reason> is a human-readable explanation
fn parse_ref_pushes(stdout: &[u8]) -> Result<GitPushStats, GitSubprocessError> {
    if !stdout.starts_with(b"To ") {
        return Err(GitSubprocessError::External(format!(
            "Git push output unfamiliar:\n{}",
            stdout.to_str_lossy()
        )));
    }

    [...]

It would be super cool if jj could be used with radicle… going back to git is not an option for me at all :-)

fintohaps commented 1 year ago

Hey! Thanks for opening the issue :) I actually use jj as well, and maintain the heartwood repo! But the difference is that I don’t use the jj git mechanism. I haven’t taken the time to understand what the benefit is there, could you explain it to me?

Regarding being compatible, I get that jj is being defensive in the expected input, but surely they could change that to something more like:

stdout.lines().skip_while(|line| !line.starts_with(b"To "))

Or something along those lines (no pun intended :P)

z6Mks2St...6Xqc commented 11 months ago

It is used as jj git push to push your references to server. How do you actually push if you are using jj to work on heartwood?

fintohaps commented 11 months ago

I use git push, I don’t need to go through jj and as far as I can tell I get the same experience. So I don’t know what I’m missing. What is jj git doing that’s special?