Skip to content

Commit

Permalink
Apply reviewer's feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Bezzubov <[email protected]>
  • Loading branch information
bzz committed Mar 7, 2018
1 parent c79efb5 commit d9a1396
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions book/B-embedding-git/sections/go-git.asc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

(((go-git)))((("Go")))
In case you want to integrate Git into a service written in Golang, there also is a pure Go library implementation.
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.
This implementation does not have any native dependencies and thus is not prone to manual memory managemen errors.
It is also transparent for the 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, which is documented https://github.com/src-d/go-git/blob/master/COMPATIBILITY.md[]
go-git is focused on extensibility, compatibility and supports most of the plumbing APIs, which is documented at https://github.com/src-d/go-git/blob/master/COMPATIBILITY.md[].

Here is a basic example of using Go APIs
Here is a basic example of using Go APIs:

[source, go]
-----
Expand All @@ -18,7 +19,7 @@ r, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{
})
-----

As soon as you have a `Repository` instance,
As soon as you have a `Repository` instance, you can access information and perform mutations on it:


[source, go]
Expand All @@ -41,7 +42,8 @@ for _, c := range history {

==== Advanced Functionality

go-git has few notable advanced features, one of which is a pluggable storage system, similar to Libgit2 backends, with a default implementation of in-memory storage.
go-git has few notable advanced features, one of which is a pluggable storage system, which is similar to Libgit2 backends.
The default implementation is in-memory storage, which is very fast.

[source, go]
-----
Expand All @@ -50,14 +52,12 @@ r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{
})
-----

That way all operations over the repository become blazingly fast as they never hit the disk.

Other storage implementations 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.
Pluggable storage provides many interesting options. For instance, https://github.com/src-d/go-git/tree/master/_examples/storage[] allows you to store references, objects, and configuration in an Aerospike 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[]
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[].

[source, go]
-----
Expand Down

0 comments on commit d9a1396

Please sign in to comment.