Skip to content

Commit 5bf8d71

Browse files
committed
all: improve Timeout docstring
1 parent 0f875a1 commit 5bf8d71

File tree

10 files changed

+111
-58
lines changed

10 files changed

+111
-58
lines changed

repo.go

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ func (r *Repository) parsePrettyFormatLogToList(timeout time.Duration, logs []by
5656
type InitOptions struct {
5757
// Indicates whether the repository should be initialized in bare format.
5858
Bare bool
59-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
59+
// The timeout duration before giving up for each shell command execution.
60+
// The default timeout duration will be used when not supplied.
6061
Timeout time.Duration
6162
}
6263

@@ -108,7 +109,8 @@ type CloneOptions struct {
108109
Quiet bool
109110
// The branch to checkout for the working tree when Bare=false.
110111
Branch string
111-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
112+
// The timeout duration before giving up for each shell command execution.
113+
// The default timeout duration will be used when not supplied.
112114
Timeout time.Duration
113115
}
114116

@@ -147,7 +149,8 @@ func Clone(url, dst string, opts ...CloneOptions) error {
147149
type FetchOptions struct {
148150
// Indicates whether to prune during fetching.
149151
Prune bool
150-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
152+
// The timeout duration before giving up for each shell command execution.
153+
// The default timeout duration will be used when not supplied.
151154
Timeout time.Duration
152155
}
153156

@@ -178,7 +181,8 @@ type PullOptions struct {
178181
Remote string
179182
// The branch to pull updates from when All=false and Remote is supplied.
180183
Branch string
181-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
184+
// The timeout duration before giving up for each shell command execution.
185+
// The default timeout duration will be used when not supplied.
182186
Timeout time.Duration
183187
}
184188

@@ -212,7 +216,8 @@ func (r *Repository) Pull(opts ...PullOptions) error {
212216
type PushOptions struct {
213217
// The environment variables set for the push.
214218
Envs []string
215-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
219+
// The timeout duration before giving up for each shell command execution.
220+
// The default timeout duration will be used when not supplied.
216221
Timeout time.Duration
217222
}
218223

@@ -232,7 +237,8 @@ func (r *Repository) Push(remote, branch string, opts ...PushOptions) error {
232237
type CheckoutOptions struct {
233238
// The base branch if checks out to a new branch.
234239
BaseBranch string
235-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
240+
// The timeout duration before giving up for each shell command execution.
241+
// The default timeout duration will be used when not supplied.
236242
Timeout time.Duration
237243
}
238244

@@ -261,7 +267,8 @@ func (r *Repository) Checkout(branch string, opts ...CheckoutOptions) error {
261267
type ResetOptions struct {
262268
// Indicates whether to perform a hard reset.
263269
Hard bool
264-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
270+
// The timeout duration before giving up for each shell command execution.
271+
// The default timeout duration will be used when not supplied.
265272
Timeout time.Duration
266273
}
267274

@@ -284,7 +291,8 @@ func (r *Repository) Reset(rev string, opts ...ResetOptions) error {
284291
// MoveOptions contains optional arguments for moving a file, a directory, or a symlink.
285292
// Docs: https://git-scm.com/docs/git-mv
286293
type MoveOptions struct {
287-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
294+
// The timeout duration before giving up for each shell command execution.
295+
// The default timeout duration will be used when not supplied.
288296
Timeout time.Duration
289297
}
290298

@@ -306,7 +314,8 @@ type AddOptions struct {
306314
All bool
307315
// The specific pathspecs to be added to index.
308316
Pathsepcs []string
309-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
317+
// The timeout duration before giving up for each shell command execution.
318+
// The default timeout duration will be used when not supplied.
310319
Timeout time.Duration
311320
}
312321

@@ -334,7 +343,8 @@ func (r *Repository) Add(opts ...AddOptions) error {
334343
type CommitOptions struct {
335344
// Author is the author of the changes if that's not the same as committer.
336345
Author *Signature
337-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
346+
// The timeout duration before giving up for each shell command execution.
347+
// The default timeout duration will be used when not supplied.
338348
Timeout time.Duration
339349
}
340350

@@ -371,7 +381,8 @@ type NameStatus struct {
371381
// ShowNameStatusOptions contains optional arguments for showing name status.
372382
// Docs: https://git-scm.com/docs/git-show#Documentation/git-show.txt---name-status
373383
type ShowNameStatusOptions struct {
374-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
384+
// The timeout duration before giving up for each shell command execution.
385+
// The default timeout duration will be used when not supplied.
375386
Timeout time.Duration
376387
}
377388

@@ -419,7 +430,8 @@ func (r *Repository) ShowNameStatus(commitID string, opts ...ShowNameStatusOptio
419430
// RevParseOptions contains optional arguments for parsing revision.
420431
// Docs: https://git-scm.com/docs/git-rev-parse
421432
type RevParseOptions struct {
422-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
433+
// The timeout duration before giving up for each shell command execution.
434+
// The default timeout duration will be used when not supplied.
423435
Timeout time.Duration
424436
}
425437

@@ -455,7 +467,8 @@ type CountObject struct {
455467
// CountObjectsOptions contains optional arguments for counting objects.
456468
// Docs: https://git-scm.com/docs/git-count-objects
457469
type CountObjectsOptions struct {
458-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
470+
// The timeout duration before giving up for each shell command execution.
471+
// The default timeout duration will be used when not supplied.
459472
Timeout time.Duration
460473
}
461474

@@ -504,7 +517,8 @@ func (r *Repository) CountObjects(opts ...CountObjectsOptions) (*CountObject, er
504517
// FsckOptions contains optional arguments for verifying the objects.
505518
// Docs: https://git-scm.com/docs/git-fsck
506519
type FsckOptions struct {
507-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
520+
// The timeout duration before giving up for each shell command execution.
521+
// The default timeout duration will be used when not supplied.
508522
Timeout time.Duration
509523
}
510524

repo_commit.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ loop:
6767
// CatFileCommitOptions contains optional arguments for verifying the objects.
6868
// Docs: https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt-lttypegt
6969
type CatFileCommitOptions struct {
70-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
70+
// The timeout duration before giving up for each shell command execution.
71+
// The default timeout duration will be used when not supplied.
7172
Timeout time.Duration
7273
}
7374

@@ -121,7 +122,8 @@ type LogOptions struct {
121122
RegexpIgnoreCase bool
122123
// The relative path of the repository.
123124
Path string
124-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
125+
// The timeout duration before giving up for each shell command execution.
126+
// The default timeout duration will be used when not supplied.
125127
Timeout time.Duration
126128
}
127129

@@ -178,7 +180,8 @@ func (r *Repository) Log(rev string, opts ...LogOptions) ([]*Commit, error) {
178180
type CommitByRevisionOptions struct {
179181
// The relative path of the repository.
180182
Path string
181-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
183+
// The timeout duration before giving up for each shell command execution.
184+
// The default timeout duration will be used when not supplied.
182185
Timeout time.Duration
183186
}
184187

@@ -210,7 +213,8 @@ func (r *Repository) CommitByRevision(rev string, opts ...CommitByRevisionOption
210213
type CommitsByPageOptions struct {
211214
// The relative path of the repository.
212215
Path string
213-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
216+
// The timeout duration before giving up for each shell command execution.
217+
// The default timeout duration will be used when not supplied.
214218
Timeout time.Duration
215219
}
216220

@@ -237,7 +241,8 @@ type SearchCommitsOptions struct {
237241
MaxCount int
238242
// The relative path of the repository.
239243
Path string
240-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
244+
// The timeout duration before giving up for each shell command execution.
245+
// The default timeout duration will be used when not supplied.
241246
Timeout time.Duration
242247
}
243248

@@ -263,7 +268,8 @@ func (r *Repository) SearchCommits(rev, pattern string, opts ...SearchCommitsOpt
263268
type CommitsSinceOptions struct {
264269
// The relative path of the repository.
265270
Path string
266-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
271+
// The timeout duration before giving up for each shell command execution.
272+
// The default timeout duration will be used when not supplied.
267273
Timeout time.Duration
268274
}
269275

@@ -289,7 +295,8 @@ type DiffNameOnlyOptions struct {
289295
NeedsMergeBase bool
290296
// The relative path of the repository.
291297
Path string
292-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
298+
// The timeout duration before giving up for each shell command execution.
299+
// The default timeout duration will be used when not supplied.
293300
Timeout time.Duration
294301
}
295302

@@ -333,7 +340,8 @@ func (r *Repository) DiffNameOnly(base, head string, opts ...DiffNameOnlyOptions
333340
type RevListCountOptions struct {
334341
// The relative path of the repository.
335342
Path string
336-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
343+
// The timeout duration before giving up for each shell command execution.
344+
// The default timeout duration will be used when not supplied.
337345
Timeout time.Duration
338346
}
339347

@@ -368,7 +376,8 @@ func (r *Repository) RevListCount(refspecs []string, opts ...RevListCountOptions
368376
type RevListOptions struct {
369377
// The relative path of the repository.
370378
Path string
371-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
379+
// The timeout duration before giving up for each shell command execution.
380+
// The default timeout duration will be used when not supplied.
372381
Timeout time.Duration
373382
}
374383

@@ -401,7 +410,8 @@ func (r *Repository) RevList(refspecs []string, opts ...RevListOptions) ([]*Comm
401410
type LatestCommitTimeOptions struct {
402411
// To get the latest commit time of the branch. When not set, it checks all branches.
403412
Branch string
404-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
413+
// The timeout duration before giving up for each shell command execution.
414+
// The default timeout duration will be used when not supplied.
405415
Timeout time.Duration
406416
}
407417

repo_diff.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ type DiffOptions struct {
1717
// The commit ID to used for computing diff between a range of commits (base, revision]. When not set,
1818
// only computes diff for a single commit at revision.
1919
Base string
20-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
20+
// The timeout duration before giving up for each shell command execution.
21+
// The default timeout duration will be used when not supplied.
2122
Timeout time.Duration
2223
}
2324

@@ -72,7 +73,8 @@ const (
7273
// RawDiffOptions contains optional arguments for dumpping a raw diff.
7374
// Docs: https://git-scm.com/docs/git-format-patch
7475
type RawDiffOptions struct {
75-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
76+
// The timeout duration before giving up for each shell command execution.
77+
// The default timeout duration will be used when not supplied.
7678
Timeout time.Duration
7779
}
7880

@@ -117,7 +119,8 @@ func (r *Repository) RawDiff(rev string, diffType RawDiffFormat, w io.Writer, op
117119

118120
// DiffBinaryOptions contains optional arguments for producing binary patch.
119121
type DiffBinaryOptions struct {
120-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
122+
// The timeout duration before giving up for each shell command execution.
123+
// The default timeout duration will be used when not supplied.
121124
Timeout time.Duration
122125
}
123126

repo_pull.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212
// MergeBaseOptions contains optional arguments for getting merge base.
1313
// // Docs: https://git-scm.com/docs/git-merge-base
1414
type MergeBaseOptions struct {
15-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
15+
// The timeout duration before giving up for each shell command execution.
16+
// The default timeout duration will be used when not supplied.
1617
Timeout time.Duration
1718
}
1819

repo_reference.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ type Reference struct {
3535
// ShowRefVerifyOptions contains optional arguments for verifying a reference.
3636
// Docs: https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---verify
3737
type ShowRefVerifyOptions struct {
38-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
38+
// The timeout duration before giving up for each shell command execution.
39+
// The default timeout duration will be used when not supplied.
3940
Timeout time.Duration
4041
}
4142

@@ -71,7 +72,8 @@ type SymbolicRefOptions struct {
7172
Name string
7273
// The name of the reference. When set, it will be used to update the symbolic ref.
7374
Ref string
74-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
75+
// The timeout duration before giving up for each shell command execution.
76+
// The default timeout duration will be used when not supplied.
7577
Timeout time.Duration
7678
}
7779

@@ -108,7 +110,8 @@ type ShowRefOptions struct {
108110
Tags bool
109111
// The list of patterns to filter results.
110112
Patterns []string
111-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
113+
// The timeout duration before giving up for each shell command execution.
114+
// The default timeout duration will be used when not supplied.
112115
Timeout time.Duration
113116
}
114117

@@ -156,7 +159,8 @@ func (r *Repository) ShowRef(opts ...ShowRefOptions) ([]*Reference, error) {
156159
type DeleteBranchOptions struct {
157160
// Indicates whether to force delete the branch.
158161
Force bool
159-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
162+
// The timeout duration before giving up for each shell command execution.
163+
// The default timeout duration will be used when not supplied.
160164
Timeout time.Duration
161165
}
162166

repo_remote.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ type LsRemoteOptions struct {
2121
Refs bool
2222
// The list of patterns to filter results.
2323
Patterns []string
24-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
24+
// The timeout duration before giving up for each shell command execution.
25+
// The default timeout duration will be used when not supplied.
2526
Timeout time.Duration
2627
}
2728

@@ -84,7 +85,8 @@ type AddRemoteOptions struct {
8485
Fetch bool
8586
// Indicates whether to add remote as mirror with --mirror=fetch.
8687
MirrorFetch bool
87-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
88+
// The timeout duration before giving up for each shell command execution.
89+
// The default timeout duration will be used when not supplied.
8890
Timeout time.Duration
8991
}
9092

@@ -110,7 +112,8 @@ func (r *Repository) AddRemote(name, url string, opts ...AddRemoteOptions) error
110112
// RemoveRemoteOptions contains arguments for removing a remote from the repository.
111113
// Docs: https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emremoveem
112114
type RemoveRemoteOptions struct {
113-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
115+
// The timeout duration before giving up for each shell command execution.
116+
// The default timeout duration will be used when not supplied.
114117
Timeout time.Duration
115118
}
116119

repo_tag.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ func (r *Repository) getTag(timeout time.Duration, id *SHA1) (*Tag, error) {
102102
// TagOptions contains optional arguments for getting a tag.
103103
// Docs: https://git-scm.com/docs/git-cat-file
104104
type TagOptions struct {
105-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
105+
// The timeout duration before giving up for each shell command execution.
106+
// The default timeout duration will be used when not supplied.
106107
Timeout time.Duration
107108
}
108109

@@ -140,7 +141,8 @@ func (r *Repository) Tag(refspec string, opts ...TagOptions) (*Tag, error) {
140141
// TagsOptions contains optional arguments for listing tags.
141142
// Docs: https://git-scm.com/docs/git-tag#Documentation/git-tag.txt---list
142143
type TagsOptions struct {
143-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
144+
// The timeout duration before giving up for each shell command execution.
145+
// The default timeout duration will be used when not supplied.
144146
Timeout time.Duration
145147
}
146148

@@ -185,7 +187,8 @@ func (r *Repository) Tags(opts ...TagsOptions) ([]string, error) {
185187
// CreateTagOptions contains optional arguments for creating a tag.
186188
// Docs: https://git-scm.com/docs/git-tag
187189
type CreateTagOptions struct {
188-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
190+
// The timeout duration before giving up for each shell command execution.
191+
// The default timeout duration will be used when not supplied.
189192
Timeout time.Duration
190193
}
191194

@@ -203,7 +206,8 @@ func (r *Repository) CreateTag(name, rev string, opts ...CreateTagOptions) error
203206
// DeleteTagOptions contains optional arguments for deleting a tag.
204207
// Docs: https://git-scm.com/docs/git-tag#Documentation/git-tag.txt---delete
205208
type DeleteTagOptions struct {
206-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
209+
// The timeout duration before giving up for each shell command execution.
210+
// The default timeout duration will be used when not supplied.
207211
Timeout time.Duration
208212
}
209213

repo_tree.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ func parseTree(t *Tree, data []byte) ([]*TreeEntry, error) {
8787
// LsTreeOptions contains optional arguments for listing trees.
8888
// Docs: https://git-scm.com/docs/git-ls-tree
8989
type LsTreeOptions struct {
90-
// The timeout duration before giving up. The default timeout duration will be used when not supplied.
90+
// The timeout duration before giving up for each shell command execution.
91+
// The default timeout duration will be used when not supplied.
9192
Timeout time.Duration
9293
}
9394

0 commit comments

Comments
 (0)