// HasLocalDiff returns true if repo has local modifications. func HasLocalDiff() (bool, error) { _, err := qexec.Run("git", "diff", "--quiet", "HEAD") status, err := qexec.ExitStatus(err) if err != nil { return false, err } return status != 0, nil }
// RefExists checks if the ref exists in the repository. func RefExists(ref string) (bool, error) { _, err := qexec.Run("git", "rev-parse", "--quiet", "--verify", ref) if err != nil { status, err := qexec.ExitStatus(err) if err != nil || status != 1 { return false, err } return false, nil } return true, nil }