Irmin graphql keys are reversed

Hi everyone.

I am using irmin and irmin-graphql. There is one thing I noticed while I am using irmin-graphql client. The thing is graphql query result of sub directories are represented reversibly. For example this is the query in graphql:

{
  master {
    tree {
      get_tree(key: "/src/ppx_irmin/lib") {
        list {
          key
          __typename
        }
      }
    }
  }
}

and this is the output:

"list": [
  {
    "key": "/lib/ppx_irmin/src/algebraic.ml",
    "__typename": "Contents"
  },
  {
    "key": "/lib/ppx_irmin/src/algebraic.mli",
    "__typename": "Contents"
  },

So you can see that /src/ppx_irmin/lib becomes /lib/ppx_irmin/src/. I would’t mind that much normally but I am trying to create a client from this queries. Therefore these reverse keys doesn’t help for the automation. I have to split and reverse them each and every time.

Is this a bug or the normal way of the query result?

  • irmin 2.1.0
  • opam 2.0.6
  • ocaml 4.09.0

I guess you can reproduce it with steps below:

opam install irmin irmin-git irmin-graphql
mkdir /tmp/irmin
cd /tmp/irmin
irmin clone -s git https://github.com/mirage/irmin.git
irmin graphql --port 9876 --root /tmp/irmin
# browse http://localhost:9876/graphql
1 Like

This looks like a bug to me. I’m currently investigating.

1 Like

This was indeed a bug, soon to be fixed by https://github.com/mirage/irmin/pull/989.

Thanks for the report!

2 Likes

Thanks for the quick reply and solution :slight_smile:

1 Like

@CraigFe irmin released new version including this bug fix?

Not yet. We have plans to cut a 2.2.0 release shortly that would include this bug fix :slight_smile: I’ll post again here once that happens.

1 Like

Now released as part of https://github.com/ocaml/opam-repository/pull/16721. Happy hacking!

1 Like

Thank you for the notification :slight_smile: