Skip to content

Conversation

bzz
Copy link
Contributor

@bzz bzz commented Feb 19, 2018

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.

Copy link
Member

@ben ben left a 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:
Copy link
Member

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Could you reformat to the single-sentence-per-source-line convention? It'll make diffs in the future much more readable.
  2. 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.

Copy link
Member

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"

Copy link
Contributor Author

@bzz bzz Mar 7, 2018

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[]
Copy link
Member

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
Copy link
Member

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,
Copy link
Member

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.
Copy link
Member

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.

Copy link
Member

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.
Copy link
Member

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[]
Copy link
Member

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[].

bzz added 5 commits March 7, 2018 14:29
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>
@bzz bzz force-pushed the embedding/add-go-git branch from a2a4424 to d9a1396 Compare March 7, 2018 14:24
@bzz
Copy link
Contributor Author

bzz commented Mar 7, 2018

@ben @jnavila thank you very much for your kind guidance!

All feedback has been addressed and it's ready for another pass.

@ben
Copy link
Member

ben commented Mar 7, 2018

Brilliant. Thanks!

@ben ben merged commit ca32012 into progit:master Mar 7, 2018
@aollier aollier added the translation backport Tags a PR for translators to backport in their own repo label Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
translation backport Tags a PR for translators to backport in their own repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants