diff options
| -rw-r--r-- | pkg/git/branch.go | 4 | ||||
| -rw-r--r-- | pkg/git/git-commands.go | 28 | ||||
| -rw-r--r-- | pkg/git/repository.go | 4 | ||||
| -rw-r--r-- | pkg/gui/gui-util.go | 4 | ||||
| -rw-r--r-- | pkg/helpers/command.go (renamed from pkg/command/command.go) | 2 | ||||
| -rw-r--r-- | pkg/helpers/utils.go (renamed from pkg/utils/utils.go) | 2 |
6 files changed, 22 insertions, 22 deletions
diff --git a/pkg/git/branch.go b/pkg/git/branch.go index 3a4f7ce..8943b21 100644 --- a/pkg/git/branch.go +++ b/pkg/git/branch.go @@ -1,7 +1,7 @@ package git import ( - "github.com/isacikgoz/gitbatch/pkg/utils" + "github.com/isacikgoz/gitbatch/pkg/helpers" "gopkg.in/src-d/go-git.v4" "gopkg.in/src-d/go-git.v4/plumbing" "strings" @@ -105,7 +105,7 @@ func (entity *RepoEntity) Checkout(branch *Branch) error { // an issue about it: https://github.com/src-d/go-git/issues/844 func (entity *RepoEntity) isClean() bool { status := entity.StatusWithGit() - status = utils.TrimTrailingNewline(status) + status = helpers.TrimTrailingNewline(status) if status != "?" { verbose := strings.Split(status, "\n") lastLine := verbose[len(verbose)-1] diff --git a/pkg/git/git-commands.go b/pkg/git/git-commands.go index 7216b17..fd56e1e 100644 --- a/pkg/git/git-commands.go +++ b/pkg/git/git-commands.go @@ -3,7 +3,7 @@ package git import ( "strings" - "github.com/isacikgoz/gitbatch/pkg/command" + "github.com/isacikgoz/gitbatch/pkg/helpers" ) // UpstreamDifferenceCount checks how many pushables/pullables there are for the @@ -11,12 +11,12 @@ import ( // TODO: get pull pushes to remote branch vs local branch func UpstreamDifferenceCount(repoPath string) (string, string) { args := []string{"rev-list", "@{u}..HEAD", "--count"} - pushableCount, err := command.RunCommandWithOutput(repoPath, "git", args) + pushableCount, err := helpers.RunCommandWithOutput(repoPath, "git", args) if err != nil { return "?", "?" } args = []string{"rev-list", "HEAD..@{u}", "--count"} - pullableCount, err := command.RunCommandWithOutput(repoPath, "git", args) + pullableCount, err := helpers.RunCommandWithOutput(repoPath, "git", args) if err != nil { return "?", "?" } @@ -26,7 +26,7 @@ func UpstreamDifferenceCount(repoPath string) (string, string) { // Instead of returning the count, this method returns the hash list func UpstreamPushDiffs(repoPath string) string { args := []string{"rev-list", "@{u}..HEAD"} - pushableCount, err := command.RunCommandWithOutput(repoPath, "git", args) + pushableCount, err := helpers.RunCommandWithOutput(repoPath, "git", args) if err != nil { return "?" } @@ -36,7 +36,7 @@ func UpstreamPushDiffs(repoPath string) string { // Instead of returning the count, this method returns the hash list func UpstreamPullDiffs(repoPath string) string { args := []string{"rev-list", "HEAD..@{u}"} - pullableCount, err := command.RunCommandWithOutput(repoPath, "git", args) + pullableCount, err := helpers.RunCommandWithOutput(repoPath, "git", args) if err != nil { return "?" } @@ -46,7 +46,7 @@ func UpstreamPullDiffs(repoPath string) string { // Conventional git show command without any argument func GitShow(repoPath, hash string) string { args := []string{"show", hash} - diff, err := command.RunCommandWithOutput(repoPath, "git", args) + diff, err := helpers.RunCommandWithOutput(repoPath, "git", args) if err != nil { return "?" } @@ -56,7 +56,7 @@ func GitShow(repoPath, hash string) string { // get author's e-mail with git show command func GitShowEmail(repoPath, hash string) string { args := []string{"show", "--quiet", "--pretty=format:%ae", hash} - diff, err := command.RunCommandWithOutput(repoPath, "git", args) + diff, err := helpers.RunCommandWithOutput(repoPath, "git", args) if err != nil { return "?" } @@ -66,7 +66,7 @@ func GitShowEmail(repoPath, hash string) string { // get body of the commit with git show func GitShowBody(repoPath, hash string) string { args := []string{"show", "--quiet", "--pretty=format:%B", hash} - diff, err := command.RunCommandWithOutput(repoPath, "git", args) + diff, err := helpers.RunCommandWithOutput(repoPath, "git", args) if err != nil { return err.Error() } @@ -76,7 +76,7 @@ func GitShowBody(repoPath, hash string) string { // get commit's date with git show as string func GitShowDate(repoPath, hash string) string { args := []string{"show", "--quiet", "--pretty=format:%ai", hash} - diff, err := command.RunCommandWithOutput(repoPath, "git", args) + diff, err := helpers.RunCommandWithOutput(repoPath, "git", args) if err != nil { return "?" } @@ -86,7 +86,7 @@ func GitShowDate(repoPath, hash string) string { // wrapper of the git fetch <remote> command func (entity *RepoEntity) FetchWithGit(remote string) error { args := []string{"fetch", remote} - _, err := command.RunCommandWithOutput(entity.AbsPath, "git", args) + _, err := helpers.RunCommandWithOutput(entity.AbsPath, "git", args) if err != nil { return err } @@ -96,7 +96,7 @@ func (entity *RepoEntity) FetchWithGit(remote string) error { // wrapper of the git pull <remote>/<branch> command func (entity *RepoEntity) PullWithGit(remote, branch string) error { args := []string{"pull", remote, branch} - _, err := command.RunCommandWithOutput(entity.AbsPath, "git", args) + _, err := helpers.RunCommandWithOutput(entity.AbsPath, "git", args) if err != nil { return err } @@ -106,7 +106,7 @@ func (entity *RepoEntity) PullWithGit(remote, branch string) error { // wrapper of the git merge <branch> command func (entity *RepoEntity) MergeWithGit(mergeFrom string) error { args := []string{"merge", mergeFrom} - _, err := command.RunCommandWithOutput(entity.AbsPath, "git", args) + _, err := helpers.RunCommandWithOutput(entity.AbsPath, "git", args) if err != nil { return err } @@ -116,7 +116,7 @@ func (entity *RepoEntity) MergeWithGit(mergeFrom string) error { // wrapper of the git checkout <branch> command func (entity *RepoEntity) CheckoutWithGit(branch string) error { args := []string{"checkout", branch} - _, err := command.RunCommandWithOutput(entity.AbsPath, "git", args) + _, err := helpers.RunCommandWithOutput(entity.AbsPath, "git", args) if err != nil { return err } @@ -126,7 +126,7 @@ func (entity *RepoEntity) CheckoutWithGit(branch string) error { // GitStatus returns the plaintext short status of the repo func (entity *RepoEntity) StatusWithGit() string { args := []string{"status"} - status, err := command.RunCommandWithOutput(entity.AbsPath, "git", args) + status, err := helpers.RunCommandWithOutput(entity.AbsPath, "git", args) if err != nil { return "?" } diff --git a/pkg/git/repository.go b/pkg/git/repository.go index e6a7c6d..75495d0 100644 --- a/pkg/git/repository.go +++ b/pkg/git/repository.go @@ -4,7 +4,7 @@ import ( "errors" "os" - "github.com/isacikgoz/gitbatch/pkg/utils" + "github.com/isacikgoz/gitbatch/pkg/helpers" "gopkg.in/src-d/go-git.v4" ) @@ -50,7 +50,7 @@ func InitializeRepository(directory string) (entity *RepoEntity, err error) { if err != nil { return nil, err } - entity = &RepoEntity{RepoID: utils.RandomString(8), + entity = &RepoEntity{RepoID: helpers.RandomString(8), Name: fileInfo.Name(), AbsPath: directory, Repository: *r, diff --git a/pkg/gui/gui-util.go b/pkg/gui/gui-util.go index 3622705..e3a7f42 100644 --- a/pkg/gui/gui-util.go +++ b/pkg/gui/gui-util.go @@ -2,7 +2,7 @@ package gui import ( "github.com/isacikgoz/gitbatch/pkg/git" - "github.com/isacikgoz/gitbatch/pkg/utils" + "github.com/isacikgoz/gitbatch/pkg/helpers" "github.com/jroimartin/gocui" ) @@ -59,7 +59,7 @@ func (gui *Gui) correctCursor(v *gocui.View) error { if oy+cy <= ly { return nil } - newCy := utils.Min(ly, maxY) + newCy := helpers.Min(ly, maxY) if err := v.SetCursor(cx, newCy); err != nil { return err } diff --git a/pkg/command/command.go b/pkg/helpers/command.go index 218f5c6..7aae7d6 100644 --- a/pkg/command/command.go +++ b/pkg/helpers/command.go @@ -1,4 +1,4 @@ -package command +package helpers import ( "log" diff --git a/pkg/utils/utils.go b/pkg/helpers/utils.go index 793339c..667597d 100644 --- a/pkg/utils/utils.go +++ b/pkg/helpers/utils.go @@ -1,4 +1,4 @@ -package utils +package helpers import ( "math/rand" |
