-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Libgit2 support #82
Merged
Merged
Libgit2 support #82
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
squaremo
force-pushed
the
libgit2-support
branch
2 times, most recently
from
January 12, 2021 14:04
73163c1
to
dc43eb9
Compare
squaremo
force-pushed
the
libgit2-support
branch
6 times, most recently
from
January 12, 2021 17:22
3a0f3a5
to
d1fa10f
Compare
hiddeco
reviewed
Jan 12, 2021
squaremo
force-pushed
the
libgit2-support
branch
2 times, most recently
from
January 13, 2021 10:57
847f1a4
to
a0ffd98
Compare
This updates the source controller module to v0.5.2, and adjusts the use of the git package therein. The main change there is that it now accounts for two different git implementations -- go-git and libgit2 -- but I have not exposed that difference, just made it work as it did before. Signed-off-by: Michael Bridgen <michael@weave.works>
This commit changes the clone and push code to use libgit2. In the case of clone, this means simply passing the const representing the libgit2 implementation to the source-controller/pkg/git function. In the case of push, this means adding a small helper to do the required invocation. NB: - there's no need to use libgit2 for operations other than clone and push; in particular, commits can have a single, go-git implementation. - libgit2's push is quite sensitive to the refspec it's given; `<branch>:refs/heads/<branch>` didn't work, and supplying no refspecs makes it time out. - libgit2 push will only work with a repository on disk that was cloned by libgit2 -- it's initialising the repo differently to go-git. This is surprising (a git repo is a git repo, isn't it?), but fine -- any given automation will use _either_ go-git or libgit2 for both of clone and push. Signed-off-by: Michael Bridgen <michael@weave.works>
This copies the approach used in source-controller: add the libgit2-dev package (i.e., headers) to the build container, then add the shared lib to the _image_ image. Signed-off-by: Michael Bridgen <michael@weave.works>
This separates the commit and push steps, since the commit step just uses gogit, while the push step will dispatch based on the git implementation. Signed-off-by: Michael Bridgen <michael@weave.works>
This follows up the stage-setting in prior commits, by respecting the GitImplementation field given in the GitRepository object. NB it only matters for cloning and pushing, so gogit is used in the "middle" to record the commit in the local checkout. Signed-off-by: Michael Bridgen <michael@weave.works>
The build now incorporates libgit2; however, most Linux distributions, notably Ubuntu and Debian, have a version of libgit2 that's over a year old. This copies the approach used in source-controller, which is to use a container image that can be preloaded with an up to date release of libgit2. Signed-off-by: Michael Bridgen <michael@weave.works>
Signed-off-by: Michael Bridgen <michael@weave.works>
hiddeco
force-pushed
the
libgit2-support
branch
from
January 14, 2021 13:19
a0ffd98
to
c532281
Compare
hiddeco
approved these changes
Jan 14, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I touched the PR myself so maybe @stefanprodan should have a look too.
Thank you @squaremo 🍇
stefanprodan
approved these changes
Jan 14, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @squaremo 🍻
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for switching to libgit2 for clone and push, for the same reason source-controller needs that option.
Fix: #71