Skip to content

Commit

Permalink
fix(changelog): use git remote to check if repo has an origin rem…
Browse files Browse the repository at this point in the history
…ote configured
  • Loading branch information
zbindenren committed Jun 30, 2021
1 parent 01af989 commit 1a3be0a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,15 @@ func (c Command) HasUncommitted() (bool, error) {
return strings.TrimSpace(out) != "", nil
}

// HasRemotes checks if a remote is configured.
// HasRemotes checks if an origin remote is configured.
func (c Command) HasRemotes() bool {
_, err := c.Run("ls-remote", "--exit-code")
return err == nil
out, err := c.Run("remote")

if err != nil {
return false
}

return strings.Contains(out, "origin")
}

// IsStaged checks if a path is staged in repository.
Expand Down

0 comments on commit 1a3be0a

Please sign in to comment.