Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into marcin/az-oidc-issuer
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Oct 4, 2023
2 parents e229efe + 78727e1 commit ddc09a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ require (
)

replace (
github.com/norwoodj/helm-docs v1.11.2 => github.com/pluralsh/helm-docs v1.11.3-0.20230914190909-3fe18acd95d7
github.com/norwoodj/helm-docs v1.11.2 => github.com/pluralsh/helm-docs v1.11.3-0.20230914191425-6d14ebab8817
go.etcd.io/etcd/pkg/v3 => go.etcd.io/etcd/pkg/v3 v3.5.0-alpha.0
k8s.io/cli-runtime => k8s.io/cli-runtime v0.26.3
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1393,8 +1393,8 @@ github.com/pluralsh/controller-reconcile-helper v0.0.4 h1:1o+7qYSyoeqKFjx+WgQTxD
github.com/pluralsh/controller-reconcile-helper v0.0.4/go.mod h1:AfY0gtteD6veBjmB6jiRx/aR4yevEf6K0M13/pGan/s=
github.com/pluralsh/gqlclient v1.10.0 h1:ccYB+A0JbPYkEeVzdfajd29l65N6x/buSKPMMxM8OIA=
github.com/pluralsh/gqlclient v1.10.0/go.mod h1:qSXKUlio1F2DRPy8el4oFYsmpKbkUYspgPB87T4it5I=
github.com/pluralsh/helm-docs v1.11.3-0.20230914190909-3fe18acd95d7 h1:tfxqRM5zNBXvKXt7TMN4z8PuNUpZ0TbaFT0WUeXSlPY=
github.com/pluralsh/helm-docs v1.11.3-0.20230914190909-3fe18acd95d7/go.mod h1:rLqec59NO7YF57Rq9VlubQHMp7wcRTJhzpkcgs4lOG4=
github.com/pluralsh/helm-docs v1.11.3-0.20230914191425-6d14ebab8817 h1:J7SGxH6nJGdRoNtqdzhyr2VMpbl4asolul7xqqW++EA=
github.com/pluralsh/helm-docs v1.11.3-0.20230914191425-6d14ebab8817/go.mod h1:rLqec59NO7YF57Rq9VlubQHMp7wcRTJhzpkcgs4lOG4=
github.com/pluralsh/oauth v0.9.2 h1:tM9hBK4tCnJUeCOgX0ctxBBCS3hiCDPoxkJLODtedmQ=
github.com/pluralsh/oauth v0.9.2/go.mod h1:aTUw/75rzcsbvW+/TLvWtHVDXFIdtFrDtUncOq9vHyM=
github.com/pluralsh/plural-operator v0.5.5 h1:57GxniNjUa3hpHgvFr9oDonFgvDUC8XDD5B0e7Xduzk=
Expand Down
24 changes: 6 additions & 18 deletions pkg/utils/git/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package git

import (
"bufio"
"fmt"
"strings"

gogit "github.com/go-git/go-git/v5"
Expand All @@ -21,33 +20,22 @@ func Repo() (*gogit.Repository, error) {
return gogit.PlainOpen(root)
}

func CurrentBranch() (b string, err error) {
repo, err := Repo()
if err != nil {
return
}

ref, err := repo.Head()
if err != nil {
return
}

b = ref.Name().Short()
return
func CurrentBranch() (string, error) {
return GitRaw("rev-parse", "--abbrev-ref", "HEAD")
}

func HasUpstreamChanges() (bool, string, error) {
repo, err := Repo()
headRef, err := GitRaw("rev-parse", "--symbolic-full-name", "HEAD")
if err != nil {
return false, "", err
}

ref, err := repo.Head()
headSha, err := GitRaw("rev-parse", "HEAD")
if err != nil {
return false, "", err
}

res, err := GitRaw("ls-remote", "origin", "-h", fmt.Sprintf("refs/heads/%s", ref.Name().Short()))
res, err := GitRaw("ls-remote", "origin", "-h", headRef)
if err != nil {
return false, "", err
}
Expand All @@ -62,7 +50,7 @@ func HasUpstreamChanges() (bool, string, error) {
}
}

return remote == ref.Hash().String(), remote, nil
return remote == headSha, remote, nil
}

func Init() (string, error) {
Expand Down

0 comments on commit ddc09a2

Please sign in to comment.