Roger-luo / Ion

Ion - a CLI toolbox for Julia developers

Home Page:https://rogerluo.dev/Ion/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Failed to read command` when attempting `ion summon`

Krastanov opened this issue · comments

I installed ion in a local path, successfully authenticated it to github, successfully used bump but then summon is erroring with error code 101:

stefan@cube ~/D/S/q/QuantumClifford.jl (master) > ion summon
Failed to read command
stefan@cube ~/D/S/q/QuantumClifford.jl (master) [101]> ion -V
ion 0.1.21

Not really sure what to do to debug now

what does it say if you run

RUST_LOG=debug ion summon

also what OS are you on? is this a linux distro?

[2023-04-09T21:42:38Z DEBUG ion::config] config file: /home/stefan/.config/ion/config.toml
[2023-04-09T21:42:38Z DEBUG ion::config] config file: true
[2023-04-09T21:42:38Z DEBUG ion::commands::summon] summoning JuliaRegistrator to register /home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl/Project.toml
[2023-04-09T21:42:38Z DEBUG ion::utils::git] get_toplevel_path("/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl")
[2023-04-09T21:42:38Z DEBUG ion::utils::read_command] Running command: Command {
        program: "git",
        args: [
            "git",
            "rev-parse",
            "--show-toplevel",
        ],
        cwd: Some(
            "/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl",
        ),
        create_pidfd: false,
    }
[2023-04-09T21:42:39Z DEBUG ion::utils::git] current_branch("/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl")
[2023-04-09T21:42:39Z DEBUG ion::utils::read_command] Running command: Command {
        program: "git",
        args: [
            "git",
            "rev-parse",
            "--abbrev-ref",
            "HEAD",
        ],
        cwd: Some(
            "/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl",
        ),
        create_pidfd: false,
    }
[2023-04-09T21:42:39Z DEBUG ion::utils::read_command] Running command: Command {
        program: "git",
        args: [
            "git",
            "symbolic-ref",
            "refs/remotes/origin/HEAD",
        ],
        cwd: Some(
            "/home/stefan/Documents/ScratchSpace/quantumjulia/QuantumClifford.jl",
        ),
        create_pidfd: false,
    }
Failed to read command

It seems the following command doesn't work

git symbolic-ref refs/remotes/origin/HEAD

this command is for getting the current default branch, could you try it locally and see if this fails?

This is on Ubuntu 22.04. It is on git 2.37.2

The command indeed fails:

> git symbolic-ref refs/remotes/origin/HEAD
fatal: ref refs/remotes/origin/HEAD is not a symbolic ref

But this issue seems very similar and seems to suggest a workaround jhauberg/gitdoctor#3

> git remote show origin
Host key fingerprint is ...
...
+----[SHA256]-----+
* remote origin
  Fetch URL: git@github.com:Krastanov/QuantumClifford.jl.git
  Push  URL: git@github.com:Krastanov/QuantumClifford.jl.git
  HEAD branch: master
... many more lines of output

Or maybe there is some standard way to create refs/remotes/origin/HEAD?

Another place where a similar issue has popped up dhimmel/manubot-rootstock@667d170

So I wrote that because of this StackOverflow post: https://stackoverflow.com/questions/28666357/how-to-get-default-git-branch

Maybe there is a more robust way of detecting the default repo branch in the remote repo, the other way might be using the GitHub API to get the default repo branch, I'm not sure if how it works yet.

If I first run git remote set-head origin --auto then git symbolic-ref refs/remotes/origin/HEAD works fine. Could that be enough of a solution?

Hmm, I think I need to understand when refs/remotes/origin/HEAD will appear first and why it might not be there first. But yeah, please use this as a workaround for now until we figure out something more robust.