Using ocaml-git in a working copy switches it to "master" branch
jnavila opened this issue · 6 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:
ocaml-git/src/git-unix/git_unix.ml
Lines 645 to 646 in 75af7de
Can you describe which behavior you want? Something like: if HEAD
exists, don't try to update it?
The ocaml-git part is here https://github.com/jnavila/plotkicadsch/blob/master/plotkicadsch/src/gitFs.ml
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 !