Skip to content

Commit a2ef6c7

Browse files
committed
Remove redundant lines accordingly common format
Use spaces instead of tabs in the code snippet
1 parent ddc4073 commit a2ef6c7

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

book/B-embedding-git/sections/go-git.asc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ r, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{
2121

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

24-
2524
[source, go]
2625
-----
2726
// retrieves the branch pointed by HEAD
@@ -39,7 +38,6 @@ for _, c := range history {
3938
}
4039
-----
4140

42-
4341
==== Advanced Functionality
4442

4543
go-git has few notable advanced features, one of which is a pluggable storage system, which is similar to Libgit2 backends.
@@ -63,13 +61,13 @@ Another advanced use-case includes a fine-tunable HTTP client, such as the one f
6361
[source, go]
6462
-----
6563
customClient := &http.Client{
66-
Transport: &http.Transport{ // accept any certificate (might be useful for testing)
67-
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
68-
},
69-
Timeout: 15 * time.Second, // 15 second timeout
70-
CheckRedirect: func(req *http.Request, via []*http.Request) error {
71-
return http.ErrUseLastResponse // don't follow redirect
72-
},
64+
Transport: &http.Transport{ // accept any certificate (might be useful for testing)
65+
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
66+
},
67+
Timeout: 15 * time.Second, // 15 second timeout
68+
CheckRedirect: func(req *http.Request, via []*http.Request) error {
69+
return http.ErrUseLastResponse // don't follow redirect
70+
},
7371
}
7472
7573
// Override http(s) default protocol to use our custom client
@@ -79,7 +77,6 @@ client.InstallProtocol("https", githttp.NewClient(customClient))
7977
r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{URL: url})
8078
-----
8179

82-
8380
==== Further Reading
8481

8582
A full treatment of go-git's capabilities is outside the scope of this book.

book/B-embedding-git/sections/libgit2.asc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ tree = commit.tree
6666
----
6767

6868
As you can see, the code is much less cluttered.
69-
Firstly, Rugged uses exceptions; it can raise things like `ConfigError` or `ObjectError` to signal error conditions.
69+
Firstly, Rugged uses exceptions; it can raise things like `ConfigError` or `ObjectError` to signal error conditions.
7070
Secondly, there's no explicit freeing of resources, since Ruby is garbage-collected.
7171
Let's take a look at a slightly more complicated example: crafting a commit from scratch
7272

@@ -108,7 +108,6 @@ commit = repo.lookup(commit_id) # <8>
108108
The Ruby code is nice and clean, but since Libgit2 is doing the heavy lifting, this code will run pretty fast, too.
109109
If you're not a rubyist, we touch on some other bindings in <<_libgit2_bindings>>.
110110

111-
112111
==== Advanced Functionality
113112

114113
Libgit2 has a couple of capabilities that are outside the scope of core Git.
@@ -187,7 +186,6 @@ Here we show a small example using a few of the more complete bindings packages
187186
The official collection of bindings can be found by browsing the repositories at https://github.com/libgit2[].
188187
The code we'll write will return the commit message from the commit eventually pointed to by HEAD (sort of like `git log -1`).
189188

190-
191189
===== LibGit2Sharp
192190

193191
(((.NET)))(((C#)))(((Mono)))
@@ -218,7 +216,6 @@ NSString *msg = [[[repo headReferenceWithError:NULL] resolvedTarget] message];
218216

219217
Objective-git is fully interoperable with Swift, so don't fear if you've left Objective-C behind.
220218

221-
222219
===== pygit2
223220

224221
(((Python)))
@@ -233,7 +230,6 @@ pygit2.Repository("/path/to/repo") # open repository
233230
.message # read the message
234231
----
235232

236-
237233
==== Further Reading
238234

239235
Of course, a full treatment of Libgit2's capabilities is outside the scope of this book.

0 commit comments

Comments
 (0)