mirage / ocaml-git

Pure OCaml Git format and protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using ocaml-git in a working copy switches it to "master" branch

jnavila opened this issue · comments

In my app, plotgitsch (https://github.com/jnavila/plotkicadsch), I use ocam-git to browse the repository. If a secondary branch is extracted, after using the app, the working copy is back on a master branch. If the branch name master does not exist (for instance the name is main), a new reference master is created from nowhere with the files of the working copy being staged.

I think you talk about this specific line:

Reference_heap.atomic_wr refs Git.Reference.head
(Fmt.str "ref: %a\n" Git.Reference.pp Git.Reference.master)

Can you describe which behavior you want? Something like: if HEAD exists, don't try to update it?

This app only browses the repository, so I would expect the working tree to be untouched.

Why would the lib have the side effect of changing the checked out revision?

Why would the lib have the side effect of changing the checked out revision?

For instance, I did not go further than a simple git init which sets by default HEAD to refs/heads/master. git-unix is not really well tested and I'm more focus on the core and the MirageOS part - so, I missed several details between git-unix & Git (due to a lack of times). But I will try to propose a PR as soon as I can 👍.

Thank you !