-
Notifications
You must be signed in to change notification settings - Fork 2k
Add go-git to Appendinx B: embedding #998
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
Conversation
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.
This is definitely a good addition to the book, thanks for writing it up! It just needs a bit of tuning.
Even non-developer applications, such as document editors, could potentially benefit from version-control features, and Git's model works very well for many different scenarios. | ||
|
||
If you need to integrate Git with your application, you have essentially three choices: spawning a shell and using the Git command-line tool; Libgit2; and JGit. | ||
If you need to integrate Git with your application, you have essentially next options: |
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.
Let's instead say this:
If you need to integrate Git with your application, you have essentially two options: spawn a shell and call the
git
command-line program, or embed a Git library into your application. Here we'll cover command-line integration and several of the most popular embeddable Git libraries.
=== go-git | ||
|
||
(((go-git)))((("Go"))) | ||
In case you want to integrate Git into a service written in Golang, there also is a pure Go library implmentation. In contrast to using a Libgit2 bindings, this implementation does not have any native dependencies, not prone to memory management errors and is transparent for standard Golang performance analysis tooling like CPU, Memory profilers, race detector, etc. |
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.
- Could you reformat to the single-sentence-per-source-line convention? It'll make diffs in the future much more readable.
- Let's try to avoid disparaging other libraries. It may be true that Go is better at managing memory than C, but it may also be true that libgit2 has some features that go-git does not.
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.
Plus there's a typo "implmentation"
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.
Thank you for your kind suggestions!
Let's try to avoid disparaging other libraries.
This of course was not an intention, thank you for noticing and pointing it out.
Will re-word asap, and also will appreciate any further improvement suggestions.
(((go-git)))((("Go"))) | ||
In case you want to integrate Git into a service written in Golang, there also is a pure Go library implmentation. In contrast to using a Libgit2 bindings, this implementation does not have any native dependencies, not prone to memory management errors and is transparent for standard Golang performance analysis tooling like CPU, Memory profilers, race detector, etc. | ||
|
||
go-git is focused on extensibility, compatibility and supports most of the plumbing APIs, wich is documented https://github.com/src-d/go-git/blob/master/COMPATIBILITY.md[] |
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.
"which is documented at [url]"
|
||
go-git is focused on extensibility, compatibility and supports most of the plumbing APIs, wich is documented https://github.com/src-d/go-git/blob/master/COMPATIBILITY.md[] | ||
|
||
Here is a basic example of using Go APIs |
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.
Usually when we have a sentence introducing an example, we end it with a period or a colon. This seems like a great place for a colon.
}) | ||
----- | ||
|
||
As soon as you have a `Repository` instance, |
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.
This also seems like a good place for a colon:
As soon as you have a
Repository
instance, you can access information and perform mutations on it:
|
||
==== Advanced Functionality | ||
|
||
go-git has few notable advanced features, one of wich is a pluggable storage system, similar to Libgit2 backends, with a default implementation of in-memory storage. |
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.
This is a lot of commas. I'd suggest splitting it up like this:
go-git has few notable advanced features, one of wich is a pluggable storage system, which is similar to Libgit2 backends. The default implementation is in-memory storage, which is very fast.
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.
another typo: "wich"
|
||
That way all operations over the repository become bazingly fast as they never hit the disk. | ||
|
||
Other storage implementaions include ability to store references, objects and configuration in a database i.e https://github.com/src-d/go-git/tree/master/_examples/storage[] an Aerospike. |
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.
Let's delete the sentence before this one, and maybe something like this here:
Pluggable storage provides many interesting options. For instance, https://github.com/src-d/go-git/tree/master/_examples/storage[Aerospike] allows you to store references, objects, and configuration in a database.
Another feature is a flexible filesystem abstraction. | ||
Using https://godoc.org/github.com/src-d/go-billy#Filesystem[] it is easy to store all the files in different way i.e by packing all of them to a single archive on disk or by keeping them all in-memory. | ||
|
||
Another advanced use-case includes a fine-tunable HTTP client https://github.com/src-d/go-git/blob/master/_examples/custom_http/main.go[] |
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.
Try to add a bit of context or a pretty display to URLs, instead of dropping them at the end of sentences:
Another advanced use-case includes a fine-tunable HTTP client, such as the one found at https://github.com/src-d/go-git/blob/master/_examples/custom_http/main.go[].
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
a2a4424
to
d9a1396
Compare
Brilliant. Thanks! |
Adds one more way of embedding Git in your application using go-git project.
go-git is quite mature, well maintained and used in production by a multiple companies implementation of Git in Golang.
Please, let me know if you guys think it could be of any value for the readers.