summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpikomonde <32364823+pikomonde@users.noreply.github.com>2024-03-21 00:44:56 +0700
committerStefan Haller <stefan@haller-berlin.de>2024-04-12 08:33:47 +0200
commite6ef1642fa0111e075fd14493b913cc4f7098db6 (patch)
treec5c31abe793c3b0b156d84afc28962f091fce9cb
parent84333eebc3be466b23627f6709ad6b000ddd21f1 (diff)
rename sha to hash
-rw-r--r--docs/Custom_Command_Keybindings.md4
-rw-r--r--pkg/app/daemon/daemon.go34
-rw-r--r--pkg/app/daemon/rebase.go4
-rw-r--r--pkg/commands/git_commands/commit_loader.go20
-rw-r--r--pkg/commands/git_commands/commit_loader_test.go70
-rw-r--r--pkg/commands/git_commands/patch.go10
-rw-r--r--pkg/commands/git_commands/rebase.go28
-rw-r--r--pkg/commands/git_commands/rebase_test.go6
-rw-r--r--pkg/commands/git_commands/reflog_commit_loader.go4
-rw-r--r--pkg/commands/git_commands/reflog_commit_loader_test.go22
-rw-r--r--pkg/commands/git_commands/stash.go14
-rw-r--r--pkg/commands/git_commands/stash_test.go2
-rw-r--r--pkg/commands/models/commit.go10
-rw-r--r--pkg/gui/context/local_commits_context.go6
-rw-r--r--pkg/gui/context/sub_commits_context.go2
-rw-r--r--pkg/gui/controllers/basic_commits_controller.go22
-rw-r--r--pkg/gui/controllers/bisect_controller.go14
-rw-r--r--pkg/gui/controllers/custom_patch_options_menu_action.go6
-rw-r--r--pkg/gui/controllers/helpers/cherry_pick_helper.go2
-rw-r--r--pkg/gui/controllers/helpers/fixup_helper.go2
-rw-r--r--pkg/gui/controllers/local_commits_controller.go30
-rw-r--r--pkg/gui/controllers/reflog_commits_controller.go2
-rw-r--r--pkg/gui/controllers/sub_commits_controller.go2
-rw-r--r--pkg/gui/controllers/undo_controller.go6
-rw-r--r--pkg/gui/modes/cherrypicking/cherry_picking.go10
-rw-r--r--pkg/gui/presentation/commits.go18
-rw-r--r--pkg/gui/presentation/commits_test.go110
-rw-r--r--pkg/gui/presentation/graph/graph.go102
-rw-r--r--pkg/gui/presentation/graph/graph_test.go304
-rw-r--r--pkg/gui/presentation/reflog_commits.go4
-rw-r--r--pkg/utils/rebase_todo.go12
-rw-r--r--pkg/utils/rebase_todo_test.go58
32 files changed, 470 insertions, 470 deletions
diff --git a/docs/Custom_Command_Keybindings.md b/docs/Custom_Command_Keybindings.md
index cca3985db..8604a5247 100644
--- a/docs/Custom_Command_Keybindings.md
+++ b/docs/Custom_Command_Keybindings.md
@@ -6,7 +6,7 @@ You can add custom command keybindings in your config.yml (accessible by pressin
customCommands:
- key: '<c-r>'
context: 'commits'
- command: 'hub browse -- "commit/{{.SelectedLocalCommit.Sha}}"'
+ command: 'hub browse -- "commit/{{.SelectedLocalCommit.Hash}}"'
- key: 'a'
context: 'files'
command: "git {{if .SelectedFile.HasUnstagedChanges}} add {{else}} reset {{end}} {{.SelectedFile.Name | quote}}"
@@ -305,7 +305,7 @@ SelectedWorktree
CheckedOutBranch
```
-To see what fields are available on e.g. the `SelectedFile`, see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/commands/models/file.go) (all the modelling lives in the same directory). Note that the custom commands feature does not guarantee backwards compatibility (until we hit Lazygit version 1.0 of course) which means a field you're accessing on an object may no longer be available from one release to the next. Typically however, all you'll need is `{{.SelectedFile.Name}}`, `{{.SelectedLocalCommit.Sha}}` and `{{.SelectedLocalBranch.Name}}`. In the future we will likely introduce a tighter interface that exposes a limited set of fields for each model.
+To see what fields are available on e.g. the `SelectedFile`, see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/commands/models/file.go) (all the modelling lives in the same directory). Note that the custom commands feature does not guarantee backwards compatibility (until we hit Lazygit version 1.0 of course) which means a field you're accessing on an object may no longer be available from one release to the next. Typically however, all you'll need is `{{.SelectedFile.Name}}`, `{{.SelectedLocalCommit.Hash}}` and `{{.SelectedLocalBranch.Name}}`. In the future we will likely introduce a tighter interface that exposes a limited set of fields for each model.
## Keybinding collisions
diff --git a/pkg/app/daemon/daemon.go b/pkg/app/daemon/daemon.go
index 2f1cded7c..280172ea2 100644
--- a/pkg/app/daemon/daemon.go
+++ b/pkg/app/daemon/daemon.go
@@ -212,7 +212,7 @@ func (self *ChangeTodoActionsInstruction) run(common *common.Common) error {
return handleInteractiveRebase(common, func(path string) error {
changes := lo.Map(self.Changes, func(c ChangeTodoAction, _ int) utils.TodoChange {
return utils.TodoChange{
- Sha: c.Sha,
+ Hash: c.Hash,
OldAction: todo.Pick,
NewAction: c.NewAction,
}
@@ -222,18 +222,18 @@ func (self *ChangeTodoActionsInstruction) run(common *common.Common) error {
})
}
-// Takes the sha of some commit, and the sha of a fixup commit that was created
+// Takes the hash of some commit, and the hash of a fixup commit that was created
// at the end of the branch, then moves the fixup commit down to right after the
// original commit, changing its type to "fixup"
type MoveFixupCommitDownInstruction struct {
- OriginalSha string
- FixupSha string
+ OriginalHash string
+ FixupHash string
}
func NewMoveFixupCommitDownInstruction(originalSha string, fixupSha string) Instruction {
return &MoveFixupCommitDownInstruction{
- OriginalSha: originalSha,
- FixupSha: fixupSha,
+ OriginalHash: originalSha,
+ FixupHash: fixupSha,
}
}
@@ -247,17 +247,17 @@ func (self *MoveFixupCommitDownInstruction) SerializedInstructions() string {
func (self *MoveFixupCommitDownInstruction) run(common *common.Common) error {
return handleInteractiveRebase(common, func(path string) error {
- return utils.MoveFixupCommitDown(path, self.OriginalSha, self.FixupSha, getCommentChar())
+ return utils.MoveFixupCommitDown(path, self.OriginalHash, self.FixupHash, getCommentChar())
})
}
type MoveTodosUpInstruction struct {
- Shas []string
+ Hashes []string
}
-func NewMoveTodosUpInstruction(shas []string) Instruction {
+func NewMoveTodosUpInstruction(hashes []string) Instruction {
return &MoveTodosUpInstruction{
- Shas: shas,
+ Hashes: hashes,
}
}
@@ -270,9 +270,9 @@ func (self *MoveTodosUpInstruction) SerializedInstructions() string {
}
func (self *MoveTodosUpInstruction) run(common *common.Common) error {
- todosToMove := lo.Map(self.Shas, func(sha string, _ int) utils.Todo {
+ todosToMove := lo.Map(self.Hashes, func(hash string, _ int) utils.Todo {
return utils.Todo{
- Sha: sha,
+ Hash: hash,
Action: todo.Pick,
}
})
@@ -283,12 +283,12 @@ func (self *MoveTodosUpInstruction) run(common *common.Common) error {
}
type MoveTodosDownInstruction struct {
- Shas []string
+ Hashes []string
}
-func NewMoveTodosDownInstruction(shas []string) Instruction {
+func NewMoveTodosDownInstruction(hashes []string) Instruction {
return &MoveTodosDownInstruction{
- Shas: shas,
+ Hashes: hashes,
}
}
@@ -301,9 +301,9 @@ func (self *MoveTodosDownInstruction) SerializedInstructions() string {
}
func (self *MoveTodosDownInstruction) run(common *common.Common) error {
- todosToMove := lo.Map(self.Shas, func(sha string, _ int) utils.Todo {
+ todosToMove := lo.Map(self.Hashes, func(hash string, _ int) utils.Todo {
return utils.Todo{
- Sha: sha,
+ Hash: hash,
Action: todo.Pick,
}
})
diff --git a/pkg/app/daemon/rebase.go b/pkg/app/daemon/rebase.go
index 50494113a..0ca323c7d 100644
--- a/pkg/app/daemon/rebase.go
+++ b/pkg/app/daemon/rebase.go
@@ -21,7 +21,7 @@ func (self *TodoLine) ToString() string {
if self.Action == "break" {
return self.Action + "\n"
} else {
- return self.Action + " " + self.Commit.Sha + " " + self.Commit.Name + "\n"
+ return self.Action + " " + self.Commit.Hash + " " + self.Commit.Name + "\n"
}
}
@@ -34,7 +34,7 @@ func TodoLinesToString(todoLines []TodoLine) string {
}
type ChangeTodoAction struct {
- Sha string
+ Hash string
NewAction todo.TodoCommand
}
diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go
index 44d0cf55d..7707f9999 100644
--- a/pkg/commands/git_commands/commit_loader.go
+++ b/pkg/commands/git_commands/commit_loader.go
@@ -129,7 +129,7 @@ func (self *CommitLoader) GetCommits(opts GetCommitsOptions) ([]*models.Commit,
}
for _, commit := range commits {
- if commit.Sha == firstPushedCommit {
+ if commit.Hash == firstPushedCommit {
passedFirstPushedCommit = true
}
if commit.Status != models.StatusRebasing {
@@ -205,7 +205,7 @@ func (self *CommitLoader) MergeRebasingCommits(commits []*models.Commit) ([]*mod
func (self *CommitLoader) extractCommitFromLine(line string, showDivergence bool) *models.Commit {
split := strings.SplitN(line, "\x00", 8)
- sha := split[0]
+ hash := split[0]
unixTimestamp := split[1]
authorName := split[2]
authorEmail := split[3]
@@ -241,7 +241,7 @@ func (self *CommitLoader) extractCommitFromLine(line string, showDivergence bool
}
return &models.Commit{
- Sha: sha,
+ Hash: hash,
Name: message,
Tags: tags,
ExtraInfo: extraInfo,
@@ -261,7 +261,7 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode
}
commitHashes := lo.FilterMap(commits, func(commit *models.Commit, _ int) (string, bool) {
- return commit.Sha, commit.Sha != ""
+ return commit.Hash, commit.Hash != ""
})
// note that we're not filtering these as we do non-rebasing commits just because
@@ -277,7 +277,7 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode
fullCommits := map[string]*models.Commit{}
err := cmdObj.RunAndProcessLines(func(line string) (bool, error) {
commit := self.extractCommitFromLine(line, false)
- fullCommits[commit.Sha] = commit
+ fullCommits[commit.Hash] = commit
return false, nil
})
if err != nil {
@@ -299,9 +299,9 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode
hydratedCommits := make([]*models.Commit, 0, len(commits))
for _, rebasingCommit := range commits {
- if rebasingCommit.Sha == "" {
+ if rebasingCommit.Hash == "" {
hydratedCommits = append(hydratedCommits, rebasingCommit)
- } else if commit := findFullCommit(rebasingCommit.Sha); commit != nil {
+ } else if commit := findFullCommit(rebasingCommit.Hash); commit != nil {
commit.Action = rebasingCommit.Action
commit.Status = rebasingCommit.Status
hydratedCommits = append(hydratedCommits, commit)
@@ -339,7 +339,7 @@ func (self *CommitLoader) getRebasingCommits(rebaseMode enums.RebaseMode) []*mod
// so, add a fake entry for it
if conflictedCommitHash := self.getConflictedCommit(todos); conflictedCommitHash != "" {
commits = append(commits, &models.Commit{
- Sha: conflictedCommitHash,
+ Hash: conflictedCommitHash,
Name: "",
Status: models.StatusRebasing,
Action: models.ActionConflict,
@@ -354,7 +354,7 @@ func (self *CommitLoader) getRebasingCommits(rebaseMode enums.RebaseMode) []*mod
continue
}
commits = utils.Prepend(commits, &models.Commit{
- Sha: t.Commit,
+ Hash: t.Commit,
Name: t.Msg,
Status: models.StatusRebasing,
Action: t.Command,
@@ -459,7 +459,7 @@ func setCommitMergedStatuses(ancestor string, commits []*models.Commit) {
passedAncestor := false
for i, commit := range commits {
// some commits aren't really commits and don't have sha's, such as the update-ref todo
- if commit.Sha != "" && strings.HasPrefix(ancestor, commit.Sha) {
+ if commit.Hash != "" && strings.HasPrefix(ancestor, commit.Hash) {
passedAncestor = true
}
if commit.Status != models.StatusPushed && commit.Status != models.StatusUnpushed {
diff --git a/pkg/commands/git_commands/commit_loader_test.go b/pkg/commands/git_commands/commit_loader_test.go
index 4792b4dff..38c03625f 100644
--- a/pkg/commands/git_commands/commit_loader_test.go
+++ b/pkg/commands/git_commands/commit_loader_test.go
@@ -86,7 +86,7 @@ func TestGetCommits(t *testing.T) {
expectedCommits: []*models.Commit{
{
- Sha: "0eea75e8c631fba6b58135697835d58ba4c18dbc",
+ Hash: "0eea75e8c631fba6b58135697835d58ba4c18dbc",
Name: "better typing for rebase mode",
Status: models.StatusUnpushed,
Action: models.ActionNone,
@@ -100,7 +100,7 @@ func TestGetCommits(t *testing.T) {
},
},
{
- Sha: "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164",
+ Hash: "b21997d6b4cbdf84b149d8e6a2c4d06a8e9ec164",
Name: "fix logging",
Status: models.StatusPushed,
Action: models.ActionNone,
@@ -114,7 +114,7 @@ func TestGetCommits(t *testing.T) {
},
},
{
- Sha: "e94e8fc5b6fab4cb755f29f1bdb3ee5e001df35c",
+ Hash: "e94e8fc5b6fab4cb755f29f1bdb3ee5e001df35c",
Name: "refactor",
Status: models.StatusPushed,
Action: models.ActionNone,
@@ -128,7 +128,7 @@ func TestGetCommits(t *testing.T) {
},
},
{
- Sha: "d8084cd558925eb7c9c38afeed5725c21653ab90",
+ Hash: "d8084cd558925eb7c9c38afeed5725c21653ab90",
Name: "WIP",
Status: models.StatusPushed,
Action: models.ActionNone,
@@ -142,7 +142,7 @@ func TestGetCommits(t *testing.T) {
},
},
{
- Sha: "65f910ebd85283b5cce9bf67d03d3f1a9ea3813a",
+ Hash: "65f910ebd85283b5cce9bf67d03d3f1a9ea3813a",
Name: "WIP",
Status: models.StatusPushed,
Action: models.ActionNone,
@@ -156,7 +156,7 @@ func TestGetCommits(t *testing.T) {
},
},
{
- Sha: "26c07b1ab33860a1a7591a0638f9925ccf497ffa",
+ Hash: "26c07b1ab33860a1a7591a0638f9925ccf497ffa",
Name: "WIP",
Status: models.StatusMerged,
Action: models.ActionNone,
@@ -170,7 +170,7 @@ func TestGetCommits(t *testing.T) {
},
},
{
- Sha: "3d4470a6c072208722e5ae9a54bcb9634959a1c5",
+ Hash: "3d4470a6c072208722e5ae9a54bcb9634959a1c5",
Name: "WIP",
Status: models.StatusMerged,
Action: models.ActionNone,
@@ -184,7 +184,7 @@ func TestGetCommits(t *testing.T) {
},
},
{
- Sha: "053a66a7be3da43aacdc7aa78e1fe757b82c4dd2",
+ Hash: "053a66a7be3da43aacdc7aa78e1fe757b82c4dd2",
Name: "refactoring the config struct",
Status: models.StatusMerged,
Action: models.ActionNone,
@@ -221,7 +221,7 @@ func TestGetCommits(t *testing.T) {
expectedCommits: []*models.Commit{
{
- Sha: "0eea75e8c631fba6b58135697835d58ba4c18dbc",
+ Hash: "0eea75e8c631fba6b58135697835d58ba4c18dbc",
Name: "better typing for rebase mode",
Status: models.StatusUnpushed,
Action: models.ActionNone,
@@ -260,7 +260,7 @@ func TestGetCommits(t *testing.T) {
expectedCommits: []*models.Commit{
{
- Sha: "0eea75e8c631fba6b58135697835d58ba4c18dbc",
+ Hash: "0eea75e8c631fba6b58135697835d58ba4c18dbc",
Name: "better typing for rebase mode",
Status: models.StatusUnpushed,
Action: models.ActionNone,
@@ -339,14 +339,14 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
todos []todo.Todo
doneTodos []todo.Todo
amendFileExists bool
- expectedSha string
+ expectedHash string
}{
{
testName: "no done todos",
todos: []todo.Todo{},
doneTodos: []todo.Todo{},
amendFileExists: false,
- expectedSha: "",
+ expectedHash: "",
},
{
testName: "common case (conflict)",
@@ -362,7 +362,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
},
},
amendFileExists: false,
- expectedSha: "fa1afe1",
+ expectedHash: "fa1afe1",
},
{
testName: "last command was 'break'",
@@ -371,7 +371,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
{Command: todo.Break},
},
amendFileExists: false,
- expectedSha: "",
+ expectedHash: "",
},
{
testName: "last command was 'exec'",
@@ -383,7 +383,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
},
},
amendFileExists: false,
- expectedSha: "",
+ expectedHash: "",
},
{
testName: "last command was 'reword'",
@@ -392,7 +392,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
{Command: todo.Reword},
},
amendFileExists: false,
- expectedSha: "",
+ expectedHash: "",
},
{
testName: "'pick' was rescheduled",
@@ -409,7 +409,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
},
},
amendFileExists: false,
- expectedSha: "",
+ expectedHash: "",
},
{
testName: "'pick' was rescheduled, buggy git version",
@@ -434,7 +434,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
},
},
amendFileExists: false,
- expectedSha: "",
+ expectedHash: "",
},
{
testName: "conflicting 'pick' after 'exec'",
@@ -459,7 +459,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
},
},
amendFileExists: false,
- expectedSha: "fa1afe1",
+ expectedHash: "fa1afe1",
},
{
testName: "'edit' with amend file",
@@ -471,7 +471,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
},
},
amendFileExists: true,
- expectedSha: "",
+ expectedHash: "",
},
{
testName: "'edit' without amend file",
@@ -483,7 +483,7 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
},
},
amendFileExists: false,
- expectedSha: "fa1afe1",
+ expectedHash: "fa1afe1",
},
}
for _, scenario := range scenarios {
@@ -503,8 +503,8 @@ func TestCommitLoader_getConflictedCommitImpl(t *testing.T) {
},
}
- sha := builder.getConflictedCommitImpl(scenario.todos, scenario.doneTodos, scenario.amendFileExists)
- assert.Equal(t, scenario.expectedSha, sha)
+ hash := builder.getConflictedCommitImpl(scenario.todos, scenario.doneTodos, scenario.amendFileExists)
+ assert.Equal(t, scenario.expectedHash, hash)
})
}
}
@@ -521,29 +521,29 @@ func TestCommitLoader_setCommitMergedStatuses(t *testing.T) {
{
testName: "basic",
commits: []*models.Commit{
- {Sha: "12345", Name: "1", Action: models.ActionNone, Status: models.StatusUnpushed},
- {Sha: "67890", Name: "2", Action: models.ActionNone, Status: models.StatusPushed},
- {Sha: "abcde", Name: "3", Action: models.ActionNone, Status: models.StatusPushed},
+ {Hash: "12345", Name: "1", Action: models.ActionNone, Status: models.StatusUnpushed},
+ {Hash: "67890", Name: "2", Action: models.ActionNone, Status: models.StatusPushed},
+ {Hash: "abcde", Name: "3", Action: models.ActionNone, Status: models.StatusPushed},
},
ancestor: "67890",
expectedCommits: []*models.Commit{
- {Sha: "12345", Name: "1", Action: models.ActionNone, Status: models.StatusUnpushed},
- {Sha: "67890", Name: "2", Action: models.ActionNone, Status: models.StatusMerged},
- {Sha: "abcde", Name: "3", Action: models.ActionNone, Status: models.StatusMerged},
+ {Hash: "12345", Name: "1", Action: models.ActionNone, Status: models.StatusUnpushed},
+ {Hash: "67890", Name: "2", Action: models.ActionNone, Status: models.StatusMerged},
+ {Hash: "abcde", Name: "3", Action: models.ActionNone, Status: models.StatusMerged},
},
},
{
testName: "with update-ref",
commits: []*models.Commit{
- {Sha: "12345", Name: "1", Action: models.ActionNone, Status: models.StatusUnpushed},
- {Sha: "", Name: "", Action: todo.UpdateRef, Status: models.StatusNone},
- {Sha: "abcde", Name: "3", Action: models.ActionNone, Status: models.StatusPushed},
+ {Hash: "12345", Name: "1", Action: models.ActionNone, Status: models.StatusUnpushed},
+ {Hash: "", Name: "", Action: todo.UpdateRef, Status: models.StatusNone},
+ {Hash: "abcde", Name: "3", Action: models.ActionNone, Status: models.StatusPushed},
},
ancestor: "deadbeef",
expectedCommits: []*models.Commit{
- {Sha: "12345", Name: "1", Action: models.ActionNone, Status: models.StatusUnpushed},
- {Sha: "", Name: "", Action: todo.UpdateRef, Status: models.StatusNone},
- {Sha: "abcde", Name: "3", Action: models.ActionNone, Status: models.StatusPushed},
+ {Hash: "12345", Name: "1", Action: models.ActionNone, Status: models.StatusUnpushed},
+ {Hash: "", Name: "", Action: todo.UpdateRef, Status: models.StatusNone},
+ {Hash: "abcde", Name: "3", Action: models.ActionNone, Status: models.StatusPushed},
},
},
}
diff --git a/pkg/commands/git_commands/patch.go b/pkg/commands/git_commands/patch.go
index c632e35ae..b6a8652bc 100644
--- a/pkg/commands/git_commands/patch.go
+++ b/pkg/commands/git_commands/patch.go
@@ -157,13 +157,13 @@ func (self *PatchCommands) MovePatchToSelectedCommit(commits []*models.Commit, s
baseIndex := sourceCommitIdx + 1
changes := []daemon.ChangeTodoAction{
- {Sha: commits[sourceCommitIdx].Sha, NewAction: todo.Edit},
- {Sha: commits[destinationCommitIdx].Sha, NewAction: todo.Edit},
+ {Hash: commits[sourceCommitIdx].Hash, NewAction: todo.Edit},
+ {Hash: commits[destinationCommitIdx].Hash, NewAction: todo.Edit},
}
self.os.LogCommand(logTodoChanges(changes), false)
err := self.rebase.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{
- baseShaOrRoot: commits[baseIndex].Sha,
+ baseShaOrRoot: commits[baseIndex].Hash,
overrideEditor: true,
instruction: daemon.NewChangeTodoActionsInstruction(changes),
}).Run()
@@ -219,7 +219,7 @@ func (self *PatchCommands) MovePatchToSelectedCommit(commits []*models.Commit, s
func (self *PatchCommands) MovePatchIntoIndex(commits []*models.Commit, commitIdx int, stash bool) error {
if stash {
- if err := self.stash.Push(self.Tr.StashPrefix + commits[commitIdx].Sha); err != nil {
+ if err := self.stash.Push(self.Tr.StashPrefix + commits[commitIdx].Hash); err != nil {
return err
}
}
@@ -324,7 +324,7 @@ func (self *PatchCommands) diffHeadAgainstCommit(commit *models.Commit) (string,
cmdArgs := NewGitCmd("diff").
Config("diff.noprefix=false").
Arg("--no-ext-diff").
- Arg("HEAD.." + commit.Sha).
+ Arg("HEAD.." + commit.Hash).
ToArgv()
return self.cmd.New(cmdArgs).RunWithOutput()
diff --git a/pkg/commands/git_commands/rebase.go b/pkg/commands/git_commands/rebase.go
index 2d1de707f..34a6c8661 100644
--- a/pkg/commands/git_commands/rebase.go
+++ b/pkg/commands/git_commands/rebase.go
@@ -56,7 +56,7 @@ func (self *RebaseCommands) RewordCommit(commits []*models.Commit, index int, su
func (self *RebaseCommands) RewordCommitInEditor(commits []*models.Commit, index int) (oscommands.ICmdObj, error) {
changes := []daemon.ChangeTodoAction{{
- Sha: commits[index].Sha,
+ Hash: commits[index].Hash,
NewAction: todo.Reword,
}}
self.os.LogCommand(logTodoChanges(changes), false)
@@ -81,7 +81,7 @@ func (self *RebaseCommands) SetCommitAuthor(commits []*models.Commit, index int,
func (self *RebaseCommands) AddCommitCoAuthor(commits []*models.Commit, index int, value string) error {
return self.GenericAmend(commits, index, func() error {
- return self.commit.AddCoAuthor(commits[index].Sha, value)
+ return self.commit.AddCoAuthor(commits[index].Hash, value)
})
}
@@ -109,7 +109,7 @@ func (self *RebaseCommands) MoveCommitsDown(commits []*models.Commit, startIdx i
baseShaOrRoot := getBaseShaOrRoot(commits, endIdx+2)
shas := lo.Map(commits[startIdx:endIdx+1], func(commit *models.Commit, _ int) string {
- return commit.Sha
+ return commit.Hash
})
return self.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{
@@ -123,7 +123,7 @@ func (self *RebaseCommands) MoveCommitsUp(commits []*models.Commit, startIdx int
baseShaOrRoot := getBaseShaOrRoot(commits, endIdx+1)
shas := lo.Map(commits[startIdx:endIdx+1], func(commit *models.Commit, _ int) string {
- return commit.Sha
+ return commit.Hash
})
return self.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{
@@ -143,7 +143,7 @@ func (self *RebaseCommands) InteractiveRebase(commits []*models.Commit, startIdx
changes := lo.Map(commits[startIdx:endIdx+1], func(commit *models.Commit, _ int) daemon.ChangeTodoAction {
return daemon.ChangeTodoAction{
- Sha: commit.Sha,
+ Hash: commit.Hash,
NewAction: action,
}
})
@@ -189,7 +189,7 @@ func (self *RebaseCommands) EditRebaseFromBaseCommit(targetBranchName string, ba
func logTodoChanges(changes []daemon.ChangeTodoAction) string {
changeTodoStr := strings.Join(lo.Map(changes, func(c daemon.ChangeTodoAction, _ int) string {
- return fmt.Sprintf("%s:%s", c.Sha, c.NewAction)
+ return fmt.Sprintf("%s:%s", c.Hash, c.NewAction)
}), "\n")
return fmt.Sprintf("Changing TODO actions:\n%s", changeTodoStr)
}
@@ -284,7 +284,7 @@ func (self *RebaseCommands) GitRebaseEditTodo(todosFileContent []byte) error {
func (self *RebaseCommands) AmendTo(commits []*models.Commit, commitIndex int) error {
commit := commits[commitIndex]
- if err := self.commit.CreateFixupCommit(commit.Sha); err != nil {
+ if err := self.commit.CreateFixupCommit(commit.Hash); err != nil {
return err
}
@@ -298,7 +298,7 @@ func (self *RebaseCommands) AmendTo(commits []*models.Commit, commitIndex int) e
return self.PrepareInteractiveRebaseCommand(PrepareInteractiveRebaseCommandOpts{
baseShaOrRoot: getBaseShaOrRoot(commits, commitIndex+1),
overrideEditor: true,
- instruction: daemon.NewMoveFixupCommitDownInstruction(commit.Sha, fixupSha),
+ instruction: daemon.NewMoveFixupCommitDownInstruction(commit.Hash, fixupSha),
}).Run()
}
@@ -306,7 +306,7 @@ func todoFromCommit(commit *models.Commit) utils.Todo {
if commit.Action == todo.UpdateRef {
return utils.Todo{Ref: commit.Name, Action: commit.Action}
} else {
- return utils.Todo{Sha: commit.Sha, Action: commit.Action}
+ return utils.Todo{Hash: commit.Hash, Action: commit.Action}
}
}
@@ -314,7 +314,7 @@ func todoFromCommit(commit *models.Commit) utils.Todo {
func (self *RebaseCommands) EditRebaseTodo(commits []*models.Commit, action todo.TodoCommand) error {
commitsWithAction := lo.Map(commits, func(commit *models.Commit, _ int) utils.TodoChange {
return utils.TodoChange{
- Sha: commit.Sha,
+ Hash: commit.Hash,
OldAction: commit.Action,
NewAction: action,
}
@@ -364,7 +364,7 @@ func (self *RebaseCommands) MoveTodosUp(commits []*models.Commit) error {
// SquashAllAboveFixupCommits squashes all fixup! commits above the given one
func (self *RebaseCommands) SquashAllAboveFixupCommits(commit *models.Commit) error {
- shaOrRoot := commit.Sha + "^"
+ shaOrRoot := commit.Hash + "^"
if commit.IsFirstCommit() {
shaOrRoot = "--root"
}
@@ -393,7 +393,7 @@ func (self *RebaseCommands) BeginInteractiveRebaseForCommit(
}
changes := []daemon.ChangeTodoAction{{
- Sha: commits[commitIndex].Sha,
+ Hash: commits[commitIndex].Hash,
NewAction: todo.Edit,
}}
self.os.LogCommand(logTodoChanges(changes), false)
@@ -506,7 +506,7 @@ func (self *RebaseCommands) DiscardOldFileChanges(commits []*models.Commit, comm
// CherryPickCommits begins an interactive rebase with the given shas being cherry picked onto HEAD
func (self *RebaseCommands) CherryPickCommits(commits []*models.Commit) error {
commitLines := lo.Map(commits, func(commit *models.Commit, _ int) string {
- return fmt.Sprintf("%s %s", utils.ShortSha(commit.Sha), commit.Name)
+ return fmt.Sprintf("%s %s", utils.ShortSha(commit.Hash), commit.Name)
})
msg := utils.ResolvePlaceholderString(
self.Tr.Log.CherryPickCommits,
@@ -544,7 +544,7 @@ func getBaseShaOrRoot(commits []*models.Commit, index int) string {
// be starting a rebase from 300 commits ago (which is the original commit limit
// at time of writing)
if index < len(commits) {
- return commits[index].Sha
+ return commits[index].Hash
} else {
return "--root"
}
diff --git a/pkg/commands/git_commands/rebase_test.go b/pkg/commands/git_commands/rebase_test.go
index b84621497..2760abd05 100644
--- a/pkg/commands/git_commands/rebase_test.go
+++ b/pkg/commands/git_commands/rebase_test.go
@@ -131,7 +131,7 @@ func TestRebaseDiscardOldFileChanges(t *testing.T) {
{
testName: "returns error when using gpg",
gitConfigMockResponses: map[string]string{"commit.gpgsign": "true"},
- commits: []*models.Commit{{Name: "commit", Sha: "123456"}},
+ commits: []*models.Commit{{Name: "commit", Hash: "123456"}},
commitIndex: 0,
fileName: []string{"test999.txt"},
runner: oscommands.NewFakeRunner(t),<