Best way to do parallel steps?

I want to create files in parallel and transfer them to different branches.

At the same time there will be multiple access. The repo.Index.Stage / repo.Commit API works in the same current directory, so I think this is out of the question.

Can you guys give me some tips on how this can be achieved? General idea?

+3
c # libgit2 libgit2sharp
source share
1 answer

In terms of feasibility, I can present two different options:

Considering "scene files in parallel" as a limitation

The word staging in a git expression implies the use of an index.

For parallel work with files, you can open many instances of the repository, each of which accepts a different pair of working directories / pointers. All of them create objects in one database of objects.

This can be achieved thanks to the optional RepositoryOptions parameter of the RepositoryOptions constructor.

See this test for a first look at how this is possible.

Alternative offer, Barebone Edition

Another option is to not use the index and create objects directly in the database of objects. However, this means that nothing will be โ€œdeliveredโ€ and that Blobs, Trees and Commits would have to be created manually.

The lower level API allows such manipulations. This API would even allow you to commit against a bare repository.

See ObjectDatabaseFixture and TreeDefinitionFixture for more information on how to achieve this.

This API will only create objects in the database. You will have to update the tip of the branches yourself. This can be achieved thanks to the Repo.Refs.Add() and Repo.Refs.UpdateTarget() methods.

+4
source share

All Articles