mock.go 1023 B

1234567891011121314151617181920212223
  1. // Copyright 2020 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package gitutil
  5. import (
  6. "github.com/gogs/git-module"
  7. )
  8. type MockModuleStore struct {
  9. RepoAddRemote func(repoPath, name, url string, opts ...git.AddRemoteOptions) error
  10. RepoDiffNameOnly func(repoPath, base, head string, opts ...git.DiffNameOnlyOptions) ([]string, error)
  11. RepoLog func(repoPath, rev string, opts ...git.LogOptions) ([]*git.Commit, error)
  12. RepoMergeBase func(repoPath, base, head string, opts ...git.MergeBaseOptions) (string, error)
  13. RepoRemoveRemote func(repoPath, name string, opts ...git.RemoveRemoteOptions) error
  14. RepoTags func(repoPath string, opts ...git.TagsOptions) ([]string, error)
  15. }
  16. // MockModule holds mock implementation of each method for Modulers interface.
  17. // When the field is non-nil, it is considered mocked. Otherwise, the real
  18. // implementation will be executed.
  19. var MockModule MockModuleStore