mirror of
https://github.com/grdl/git-get.git
synced 2026-02-04 17:24:49 +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)
|
return fmt.Sprintf("git-get %s", version)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gitconfig represents gitconfig file
|
// Gitconfig represents gitconfig file.
|
||||||
type Gitconfig interface {
|
type Gitconfig interface {
|
||||||
Get(key string) string
|
Get(key string) string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func parseDumpFile(path string) ([]parsedLine, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// parseLine splits a dump file line into space-separated segments.
|
// 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) {
|
func parseLine(line string) (parsedLine, error) {
|
||||||
var parsed parsedLine
|
var parsed parsedLine
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ func Clone(opts *CloneOpts) (*Repo, error) {
|
|||||||
return Repo, err
|
return Repo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch preforms a git fetch on all remotes
|
// Fetch preforms a git fetch on all remotes.
|
||||||
func (r *Repo) Fetch() error {
|
func (r *Repo) Fetch() error {
|
||||||
err := run.Git("fetch", "--all").OnRepo(r.path).AndShutUp()
|
err := run.Git("fetch", "--all").OnRepo(r.path).AndShutUp()
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -160,22 +160,22 @@ func (s *Status) Branches() []string {
|
|||||||
return branches
|
return branches
|
||||||
}
|
}
|
||||||
|
|
||||||
// BranchStatus returns status of a given branch
|
// BranchStatus returns status of a given branch.
|
||||||
func (s *Status) BranchStatus(branch string) string {
|
func (s *Status) BranchStatus(branch string) string {
|
||||||
return s.branches[branch]
|
return s.branches[branch]
|
||||||
}
|
}
|
||||||
|
|
||||||
// WorkTreeStatus returns status of a worktree
|
// WorkTreeStatus returns status of a worktree.
|
||||||
func (s *Status) WorkTreeStatus() string {
|
func (s *Status) WorkTreeStatus() string {
|
||||||
return s.worktree
|
return s.worktree
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remote returns URL to remote repository
|
// Remote returns URL to remote repository.
|
||||||
func (s *Status) Remote() string {
|
func (s *Status) Remote() string {
|
||||||
return s.remote
|
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 {
|
func (s *Status) Errors() []string {
|
||||||
return s.errors
|
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) {
|
func removeTestDir(t *testing.T, dir string) {
|
||||||
// Skip cleanup on Windows to avoid file locking issues in CI
|
// Skip cleanup on Windows to avoid file locking issues in CI
|
||||||
// The CI runner environment is destroyed after tests anyway
|
// The CI runner environment is destroyed after tests anyway
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ func RepoWithBranchAheadAndBehind(t *testing.T) *Repo {
|
|||||||
return r
|
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 {
|
func RepoWithEmptyConfig(t *testing.T) *Repo {
|
||||||
r := RepoEmpty(t)
|
r := RepoEmpty(t)
|
||||||
r.writeFile(filepath.Join(".git", "config"), "")
|
r.writeFile(filepath.Join(".git", "config"), "")
|
||||||
@@ -180,7 +180,7 @@ func RepoWithEmptyConfig(t *testing.T) *Repo {
|
|||||||
return r
|
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 {
|
func RepoWithValidConfig(t *testing.T) *Repo {
|
||||||
r := RepoEmpty(t)
|
r := RepoEmpty(t)
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const (
|
|||||||
head = "HEAD"
|
head = "HEAD"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Printable represents a repository which status can be printed
|
// Printable represents a repository which status can be printed.
|
||||||
type Printable interface {
|
type Printable interface {
|
||||||
Path() string
|
Path() string
|
||||||
Current() string
|
Current() string
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ func indentation(node *Node) string {
|
|||||||
return indent.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 {
|
func (n *Node) isYoungest() bool {
|
||||||
if n.parent == nil {
|
if n.parent == nil {
|
||||||
return true
|
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
|
// 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.
|
// 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 {
|
func URLToPath(url urlpkg.URL, skipHost bool) string {
|
||||||
// Remove port numbers from host.
|
// Remove port numbers from host.
|
||||||
url.Host = strings.Split(url.Host, ":")[0]
|
url.Host = strings.Split(url.Host, ":")[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user