Pergunta

I try to write a file store based on libgit2. Software snapshots should be saved as branches mysoftware and specific versions committed and tagged. Then later I want to checkout the tags to different directories.

When looking at git_checkout_tree, it seems like there is only one working tree for a repository and thus it does not even seem possible to checkout multiple working trees concurrently. Is this correct!?

EDIT:

Additionally, I would like for this thing to work on Windows without the need for cygwin!

Foi útil?

Solução

The git_checkout_opts structure in libgit2 contains a target_directory option that will allow git_checkout_tree() to write to a different directory instead of using the default working tree for the repository. This would allow you to custom build a solution with libgit2 that maintained multiple checked out copies.

Without using that option, a libgit2 git_repository object expects there will be just one working directory and looks to the core.worktree config option if it isn't the "natural" working directory for the repository.

The git-new-workdir tricks with symlinks in the .git directory don't work great with libgit2 right now, I'm afraid, and particularly doesn't work well on Windows. I'd love to see this addressed, but it isn't too high on my priority list.

Outras dicas

Git doesn't support this natively, but you can use git-new-workdir to do it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top