mirror of
https://github.com/grdl/git-get.git
synced 2026-02-04 11:01:46 +00:00
Fix issues found by godot linter
This commit is contained in:
@@ -65,7 +65,7 @@ func Version() string {
|
||||
return fmt.Sprintf("git-get %s", version)
|
||||
}
|
||||
|
||||
// Gitconfig represents gitconfig file
|
||||
// Gitconfig represents gitconfig file.
|
||||
type Gitconfig interface {
|
||||
Get(key string) string
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func parseDumpFile(path string) ([]parsedLine, error) {
|
||||
}
|
||||
|
||||
// parseLine splits a dump file line into space-separated segments.
|
||||
// First part is the URL to clone. Second, optional, is the branch (or tag) to checkout after cloning
|
||||
// First part is the URL to clone. Second, optional, is the branch (or tag) to checkout after cloning.
|
||||
func parseLine(line string) (parsedLine, error) {
|
||||
var parsed parsedLine
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ func Clone(opts *CloneOpts) (*Repo, error) {
|
||||
return Repo, err
|
||||
}
|
||||
|
||||
// Fetch preforms a git fetch on all remotes
|
||||
// Fetch preforms a git fetch on all remotes.
|
||||
func (r *Repo) Fetch() error {
|
||||
err := run.Git("fetch", "--all").OnRepo(r.path).AndShutUp()
|
||||
return err
|
||||
|
||||
@@ -160,22 +160,22 @@ func (s *Status) Branches() []string {
|
||||
return branches
|
||||
}
|
||||
|
||||
// BranchStatus returns status of a given branch
|
||||
// BranchStatus returns status of a given branch.
|
||||
func (s *Status) BranchStatus(branch string) string {
|
||||
return s.branches[branch]
|
||||
}
|
||||
|
||||
// WorkTreeStatus returns status of a worktree
|
||||
// WorkTreeStatus returns status of a worktree.
|
||||
func (s *Status) WorkTreeStatus() string {
|
||||
return s.worktree
|
||||
}
|
||||
|
||||
// Remote returns URL to remote repository
|
||||
// Remote returns URL to remote repository.
|
||||
func (s *Status) Remote() string {
|
||||
return s.remote
|
||||
}
|
||||
|
||||
// Errors is a slice of errors that occurred when loading repo status
|
||||
// Errors is a slice of errors that occurred when loading repo status.
|
||||
func (s *Status) Errors() []string {
|
||||
return s.errors
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func checkFatal(t *testing.T, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
// removeTestDir removes a test directory
|
||||
// removeTestDir removes a test directory.
|
||||
func removeTestDir(t *testing.T, dir string) {
|
||||
// Skip cleanup on Windows to avoid file locking issues in CI
|
||||
// The CI runner environment is destroyed after tests anyway
|
||||
|
||||
@@ -172,7 +172,7 @@ func RepoWithBranchAheadAndBehind(t *testing.T) *Repo {
|
||||
return r
|
||||
}
|
||||
|
||||
// RepoWithEmptyConfig creates a git repo with empty .git/config file
|
||||
// RepoWithEmptyConfig creates a git repo with empty .git/config file.
|
||||
func RepoWithEmptyConfig(t *testing.T) *Repo {
|
||||
r := RepoEmpty(t)
|
||||
r.writeFile(filepath.Join(".git", "config"), "")
|
||||
@@ -180,7 +180,7 @@ func RepoWithEmptyConfig(t *testing.T) *Repo {
|
||||
return r
|
||||
}
|
||||
|
||||
// RepoWithValidConfig creates a git repo with valid content in .git/config file
|
||||
// RepoWithValidConfig creates a git repo with valid content in .git/config file.
|
||||
func RepoWithValidConfig(t *testing.T) *Repo {
|
||||
r := RepoEmpty(t)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const (
|
||||
head = "HEAD"
|
||||
)
|
||||
|
||||
// Printable represents a repository which status can be printed
|
||||
// Printable represents a repository which status can be printed.
|
||||
type Printable interface {
|
||||
Path() string
|
||||
Current() string
|
||||
|
||||
@@ -203,7 +203,7 @@ func indentation(node *Node) string {
|
||||
return indent.String()
|
||||
}
|
||||
|
||||
// isYoungest checks if the node is the last one in the slice of children
|
||||
// isYoungest checks if the node is the last one in the slice of children.
|
||||
func (n *Node) isYoungest() bool {
|
||||
if n.parent == nil {
|
||||
return true
|
||||
|
||||
@@ -89,7 +89,7 @@ func normalizeURL(url *urlpkg.URL, defaultHost string, defaultScheme string) {
|
||||
// Eg, ssh://git@github.com:22/~user/repo.git => github.com/user/repo
|
||||
//
|
||||
// If skipHost is true, it removes the host part from the path.
|
||||
// Eg, ssh://git@github.com:22/~user/repo.git => user/repo
|
||||
// Eg, ssh://git@github.com:22/~user/repo.git => user/repo.
|
||||
func URLToPath(url urlpkg.URL, skipHost bool) string {
|
||||
// Remove port numbers from host.
|
||||
url.Host = strings.Split(url.Host, ":")[0]
|
||||
|
||||
Reference in New Issue
Block a user