File tree 1 file changed +15
-3
lines changed
1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -527,18 +527,30 @@ func (r *Repository) CountObjects(opts ...CountObjectsOptions) (*CountObject, er
527
527
// FsckOptions contains optional arguments for verifying the objects.
528
528
// Docs: https://git-scm.com/docs/git-fsck
529
529
type FsckOptions struct {
530
+ // The additional arguments to be applied.
531
+ Args []string
530
532
// The timeout duration before giving up for each shell command execution.
531
533
// The default timeout duration will be used when not supplied.
532
534
Timeout time.Duration
533
535
}
534
536
535
- // Fsck verifies the connectivity and validity of the objects in the database for the repository.
536
- func (r * Repository ) Fsck (opts ... FsckOptions ) error {
537
+ // RepoFsck verifies the connectivity and validity of the objects in the database for the
538
+ // repository in given path.
539
+ func RepoFsck (repoPath string , opts ... FsckOptions ) error {
537
540
var opt FsckOptions
538
541
if len (opts ) > 0 {
539
542
opt = opts [0 ]
540
543
}
541
544
542
- _ , err := NewCommand ("fsck" ).RunInDirWithTimeout (opt .Timeout , r .path )
545
+ cmd := NewCommand ("fsck" )
546
+ if len (opt .Args ) > 0 {
547
+ cmd .AddArgs (opt .Args ... )
548
+ }
549
+ _ , err := cmd .RunInDirWithTimeout (opt .Timeout , repoPath )
543
550
return err
544
551
}
552
+
553
+ // Fsck verifies the connectivity and validity of the objects in the database for the repository.
554
+ func (r * Repository ) Fsck (opts ... FsckOptions ) error {
555
+ return RepoFsck (r .path , opts ... )
556
+ }
You can’t perform that action at this time.
0 commit comments