From bb0d2ee079a0f56e18de9f88b3b9f1c068b0798d Mon Sep 17 00:00:00 2001 From: Ibrahim Serdar Acikgoz Date: Fri, 4 Jan 2019 04:17:28 +0300 Subject: refactor on var name --- core/command/cmd-add.go | 18 +++--- core/command/cmd-commit.go | 24 ++++---- core/command/cmd-config.go | 24 ++++---- core/command/cmd-diff.go | 18 +++--- core/command/cmd-fetch.go | 36 ++++++------ core/command/cmd-merge.go | 8 +-- core/command/cmd-pull.go | 32 +++++------ core/command/cmd-reset.go | 22 ++++---- core/command/cmd-status.go | 22 ++++---- core/git/branch.go | 52 ++++++++--------- core/git/commit.go | 46 +++++++-------- core/git/remote.go | 34 ++++++------ core/git/remotebranch.go | 34 ++++++------ core/git/repository.go | 136 ++++++++++++++++++++++----------------------- core/git/sort.go | 8 +-- core/git/stash.go | 20 +++---- core/job/job-queue.go | 10 ++-- core/job/job.go | 32 +++++------ core/load/load.go | 6 +- gui/authenticationview.go | 12 ++-- gui/commitview.go | 16 +++--- gui/diffview.go | 12 ++-- gui/gui.go | 8 +-- gui/mainview.go | 24 ++++---- gui/sideviews.go | 108 +++++++++++++++++------------------ gui/stagedview.go | 14 ++--- gui/stashview.go | 24 ++++---- gui/statusview.go | 26 ++++----- gui/unstagedview.go | 12 ++-- gui/util-textstyle.go | 38 ++++++------- 30 files changed, 438 insertions(+), 438 deletions(-) diff --git a/core/command/cmd-add.go b/core/command/cmd-add.go index 2addb23..5ad8774 100644 --- a/core/command/cmd-add.go +++ b/core/command/cmd-add.go @@ -26,31 +26,31 @@ type AddOptions struct { } // Add is a wrapper function for "git add" command -func Add(e *git.RepoEntity, file *File, option AddOptions) error { +func Add(r *git.Repository, file *File, option AddOptions) error { addCmdMode = addCmdModeNative if option.Update || option.Force || option.DryRun { addCmdMode = addCmdModeLegacy } switch addCmdMode { case addCmdModeLegacy: - err := addWithGit(e, file, option) + err := addWithGit(r, file, option) return err case addCmdModeNative: - err := addWithGoGit(e, file) + err := addWithGoGit(r, file) return err } return errors.New("Unhandled add operation") } // AddAll function is the wrapper of "git add ." command -func AddAll(e *git.RepoEntity, option AddOptions) error { +func AddAll(r *git.Repository, option AddOptions) error { args := make([]string, 0) args = append(args, addCommand) if option.DryRun { args = append(args, "--dry-run") } args = append(args, ".") - out, err := GenericGitCommandWithOutput(e.AbsPath, args) + out, err := GenericGitCommandWithOutput(r.AbsPath, args) if err != nil { log.Warn("Error while add command") return errors.New(out + "\n" + err.Error()) @@ -58,7 +58,7 @@ func AddAll(e *git.RepoEntity, option AddOptions) error { return nil } -func addWithGit(e *git.RepoEntity, file *File, option AddOptions) error { +func addWithGit(r *git.Repository, file *File, option AddOptions) error { args := make([]string, 0) args = append(args, addCommand) args = append(args, file.Name) @@ -71,7 +71,7 @@ func addWithGit(e *git.RepoEntity, file *File, option AddOptions) error { if option.DryRun { args = append(args, "--dry-run") } - out, err := GenericGitCommandWithOutput(e.AbsPath, args) + out, err := GenericGitCommandWithOutput(r.AbsPath, args) if err != nil { log.Warn("Error while add command") return errors.New(out + "\n" + err.Error()) @@ -79,8 +79,8 @@ func addWithGit(e *git.RepoEntity, file *File, option AddOptions) error { return nil } -func addWithGoGit(e *git.RepoEntity, file *File) error { - w, err := e.Repository.Worktree() +func addWithGoGit(r *git.Repository, file *File) error { + w, err := r.Repo.Worktree() if err != nil { return err } diff --git a/core/command/cmd-commit.go b/core/command/cmd-commit.go index d81942e..bf81a25 100644 --- a/core/command/cmd-commit.go +++ b/core/command/cmd-commit.go @@ -29,22 +29,22 @@ type CommitOptions struct { } // CommitCommand defines which commit command to use. -func CommitCommand(e *git.RepoEntity, options CommitOptions) (err error) { +func CommitCommand(r *git.Repository, options CommitOptions) (err error) { // here we configure commit operation // default mode is go-git (this may be configured) commitCmdMode = commitCmdModeNative switch commitCmdMode { case commitCmdModeLegacy: - return commitWithGit(e, options) + return commitWithGit(r, options) case commitCmdModeNative: - return commitWithGoGit(e, options) + return commitWithGoGit(r, options) } return errors.New("Unhandled commit operation") } // commitWithGit is simply a bare git commit -m command which is flexible -func commitWithGit(e *git.RepoEntity, options CommitOptions) (err error) { +func commitWithGit(r *git.Repository, options CommitOptions) (err error) { args := make([]string, 0) args = append(args, commitCommand) args = append(args, "-m") @@ -52,18 +52,18 @@ func commitWithGit(e *git.RepoEntity, options CommitOptions) (err error) { if len(options.CommitMsg) > 0 { args = append(args, options.CommitMsg) } - if err := GenericGitCommand(e.AbsPath, args); err != nil { + if err := GenericGitCommand(r.AbsPath, args); err != nil { log.Warn("Error at git command (commit)") - e.Refresh() + r.Refresh() return err } // till this step everything should be ok - return e.Refresh() + return r.Refresh() } // commitWithGoGit is the primary commit method -func commitWithGoGit(e *git.RepoEntity, options CommitOptions) (err error) { - config, err := e.Repository.Config() +func commitWithGoGit(r *git.Repository, options CommitOptions) (err error) { + config, err := r.Repo.Config() if err != nil { return err } @@ -77,16 +77,16 @@ func commitWithGoGit(e *git.RepoEntity, options CommitOptions) (err error) { }, } - w, err := e.Repository.Worktree() + w, err := r.Repo.Worktree() if err != nil { return err } _, err = w.Commit(options.CommitMsg, opt) if err != nil { - e.Refresh() + r.Refresh() return err } // till this step everything should be ok - return e.Refresh() + return r.Refresh() } diff --git a/core/command/cmd-config.go b/core/command/cmd-config.go index c580ff6..35eff23 100644 --- a/core/command/cmd-config.go +++ b/core/command/cmd-config.go @@ -37,22 +37,22 @@ const ( ) // Config adds or reads config of a repository -func Config(e *git.RepoEntity, options ConfigOptions) (value string, err error) { +func Config(r *git.Repository, options ConfigOptions) (value string, err error) { // here we configure config operation // default mode is go-git (this may be configured) configCmdMode = configCmdModeLegacy switch configCmdMode { case configCmdModeLegacy: - return configWithGit(e, options) + return configWithGit(r, options) case configCmdModeNative: - return configWithGoGit(e, options) + return configWithGoGit(r, options) } return value, errors.New("Unhandled config operation") } // configWithGit is simply a bare git commit -m command which is flexible -func configWithGit(e *git.RepoEntity, options ConfigOptions) (value string, err error) { +func configWithGit(r *git.Repository, options ConfigOptions) (value string, err error) { args := make([]string, 0) args = append(args, configCommand) if len(string(options.Site)) > 0 { @@ -61,7 +61,7 @@ func configWithGit(e *git.RepoEntity, options ConfigOptions) (value string, err args = append(args, "--get") args = append(args, options.Section+"."+options.Option) // parse options to command line arguments - out, err := GenericGitCommandWithOutput(e.AbsPath, args) + out, err := GenericGitCommandWithOutput(r.AbsPath, args) if err != nil { return out, err } @@ -70,9 +70,9 @@ func configWithGit(e *git.RepoEntity, options ConfigOptions) (value string, err } // commitWithGoGit is the primary commit method -func configWithGoGit(e *git.RepoEntity, options ConfigOptions) (value string, err error) { +func configWithGoGit(r *git.Repository, options ConfigOptions) (value string, err error) { // TODO: add global search - config, err := e.Repository.Config() + config, err := r.Repo.Config() if err != nil { return value, err } @@ -80,13 +80,13 @@ func configWithGoGit(e *git.RepoEntity, options ConfigOptions) (value string, er } // AddConfig adds an entry on the ConfigOptions field. -func AddConfig(e *git.RepoEntity, options ConfigOptions, value string) (err error) { - return addConfigWithGit(e, options, value) +func AddConfig(r *git.Repository, options ConfigOptions, value string) (err error) { + return addConfigWithGit(r, options, value) } // addConfigWithGit is simply a bare git config --add