Skip to content

Commit f354a82

Browse files
committed
Add timeout safe check for fsck
1 parent 1193908 commit f354a82

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

git.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"time"
1111
)
1212

13-
const _VERSION = "0.2.3"
13+
const _VERSION = "0.2.4"
1414

1515
func Version() string {
1616
return _VERSION
@@ -71,6 +71,10 @@ func init() {
7171

7272
// Fsck verifies the connectivity and validity of the objects in the database
7373
func Fsck(repoPath string, timeout time.Duration, args ...string) error {
74+
// Make sure timeout makes sense.
75+
if timeout <= 0 {
76+
timeout == -1
77+
}
7478
_, err := NewCommand("fsck").AddArguments(args...).RunInDirTimeout(timeout, repoPath)
7579
return err
7680
}

0 commit comments

Comments
 (0)