mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	rename sha to hash
This commit is contained in:
		| @@ -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 | ||||
|  | ||||
|   | ||||
| @@ -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, | ||||
| 		} | ||||
| 	}) | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -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}, | ||||
| 			}, | ||||
| 		}, | ||||
| 	} | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
| @@ -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" | ||||
| 	} | ||||
|   | ||||
| @@ -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), | ||||
| @@ -143,8 +143,8 @@ func TestRebaseDiscardOldFileChanges(t *testing.T) { | ||||
| 			testName:               "checks out file if it already existed", | ||||
| 			gitConfigMockResponses: nil, | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit", Sha: "123456"}, | ||||
| 				{Name: "commit2", Sha: "abcdef"}, | ||||
| 				{Name: "commit", Hash: "123456"}, | ||||
| 				{Name: "commit2", Hash: "abcdef"}, | ||||
| 			}, | ||||
| 			commitIndex: 0, | ||||
| 			fileName:    []string{"test999.txt"}, | ||||
|   | ||||
| @@ -65,7 +65,7 @@ func (self *ReflogCommitLoader) GetReflogCommits(lastReflogCommit *models.Commit | ||||
| } | ||||
|  | ||||
| func (self *ReflogCommitLoader) sameReflogCommit(a *models.Commit, b *models.Commit) bool { | ||||
| 	return a.Sha == b.Sha && a.UnixTimestamp == b.UnixTimestamp && a.Name == b.Name | ||||
| 	return a.Hash == b.Hash && a.UnixTimestamp == b.UnixTimestamp && a.Name == b.Name | ||||
| } | ||||
|  | ||||
| func (self *ReflogCommitLoader) parseLine(line string) (*models.Commit, bool) { | ||||
| @@ -83,7 +83,7 @@ func (self *ReflogCommitLoader) parseLine(line string) (*models.Commit, bool) { | ||||
| 	} | ||||
|  | ||||
| 	return &models.Commit{ | ||||
| 		Sha:           fields[0], | ||||
| 		Hash:          fields[0], | ||||
| 		Name:          fields[2], | ||||
| 		UnixTimestamp: int64(unixTimestamp), | ||||
| 		Status:        models.StatusReflog, | ||||
|   | ||||
| @@ -50,35 +50,35 @@ func TestGetReflogCommits(t *testing.T) { | ||||
| 			lastReflogCommit: nil, | ||||
| 			expectedCommits: []*models.Commit{ | ||||
| 				{ | ||||
| 					Sha:           "c3c4b66b64c97ffeecde", | ||||
| 					Hash:          "c3c4b66b64c97ffeecde", | ||||
| 					Name:          "checkout: moving from A to B", | ||||
| 					Status:        models.StatusReflog, | ||||
| 					UnixTimestamp: 1643150483, | ||||
| 					Parents:       []string{"51baa8c1"}, | ||||
| 				}, | ||||
| 				{ | ||||
| 					Sha:           "c3c4b66b64c97ffeecde", | ||||
| 					Hash:          "c3c4b66b64c97ffeecde", | ||||
| 					Name:          "checkout: moving from B to A", | ||||
| 					Status:        models.StatusReflog, | ||||
| 					UnixTimestamp: 1643150483, | ||||
| 					Parents:       []string{"51baa8c1"}, | ||||
| 				}, | ||||
| 				{ | ||||
| 					Sha:           "c3c4b66b64c97ffeecde", | ||||
| 					Hash:          "c3c4b66b64c97ffeecde", | ||||
| 					Name:          "checkout: moving from A to B", | ||||
| 					Status:        models.StatusReflog, | ||||
| 					UnixTimestamp: 1643150483, | ||||
| 					Parents:       []string{"51baa8c1"}, | ||||
| 				}, | ||||
| 				{ | ||||
| 					Sha:           "c3c4b66b64c97ffeecde", | ||||
| 					Hash:          "c3c4b66b64c97ffeecde", | ||||
| 					Name:          "checkout: moving from master to A", | ||||
| 					Status:        models.StatusReflog, | ||||
| 					UnixTimestamp: 1643150483, | ||||
| 					Parents:       []string{"51baa8c1"}, | ||||
| 				}, | ||||
| 				{ | ||||
| 					Sha:           "f4ddf2f0d4be4ccc7efa", | ||||
| 					Hash:          "f4ddf2f0d4be4ccc7efa", | ||||
| 					Name:          "checkout: moving from A to master", | ||||
| 					Status:        models.StatusReflog, | ||||
| 					UnixTimestamp: 1643149435, | ||||
| @@ -94,7 +94,7 @@ func TestGetReflogCommits(t *testing.T) { | ||||
| 				ExpectGitArgs([]string{"-c", "log.showSignature=false", "log", "-g", "--abbrev=40", "--format=%h%x00%ct%x00%gs%x00%p"}, reflogOutput, nil), | ||||
|  | ||||
| 			lastReflogCommit: &models.Commit{ | ||||
| 				Sha:           "c3c4b66b64c97ffeecde", | ||||
| 				Hash:          "c3c4b66b64c97ffeecde", | ||||
| 				Name:          "checkout: moving from B to A", | ||||
| 				Status:        models.StatusReflog, | ||||
| 				UnixTimestamp: 1643150483, | ||||
| @@ -102,7 +102,7 @@ func TestGetReflogCommits(t *testing.T) { | ||||
| 			}, | ||||
| 			expectedCommits: []*models.Commit{ | ||||
| 				{ | ||||
| 					Sha:           "c3c4b66b64c97ffeecde", | ||||
| 					Hash:          "c3c4b66b64c97ffeecde", | ||||
| 					Name:          "checkout: moving from A to B", | ||||
| 					Status:        models.StatusReflog, | ||||
| 					UnixTimestamp: 1643150483, | ||||
| @@ -118,7 +118,7 @@ func TestGetReflogCommits(t *testing.T) { | ||||
| 				ExpectGitArgs([]string{"-c", "log.showSignature=false", "log", "-g", "--abbrev=40", "--format=%h%x00%ct%x00%gs%x00%p", "--follow", "--", "path"}, reflogOutput, nil), | ||||
|  | ||||
| 			lastReflogCommit: &models.Commit{ | ||||
| 				Sha:           "c3c4b66b64c97ffeecde", | ||||
| 				Hash:          "c3c4b66b64c97ffeecde", | ||||
| 				Name:          "checkout: moving from B to A", | ||||
| 				Status:        models.StatusReflog, | ||||
| 				UnixTimestamp: 1643150483, | ||||
| @@ -127,7 +127,7 @@ func TestGetReflogCommits(t *testing.T) { | ||||
| 			filterPath: "path", | ||||
| 			expectedCommits: []*models.Commit{ | ||||
| 				{ | ||||
| 					Sha:           "c3c4b66b64c97ffeecde", | ||||
| 					Hash:          "c3c4b66b64c97ffeecde", | ||||
| 					Name:          "checkout: moving from A to B", | ||||
| 					Status:        models.StatusReflog, | ||||
| 					UnixTimestamp: 1643150483, | ||||
| @@ -143,7 +143,7 @@ func TestGetReflogCommits(t *testing.T) { | ||||
| 				ExpectGitArgs([]string{"-c", "log.showSignature=false", "log", "-g", "--abbrev=40", "--format=%h%x00%ct%x00%gs%x00%p", "--author=John Doe <john@doe.com>"}, reflogOutput, nil), | ||||
|  | ||||
| 			lastReflogCommit: &models.Commit{ | ||||
| 				Sha:           "c3c4b66b64c97ffeecde", | ||||
| 				Hash:          "c3c4b66b64c97ffeecde", | ||||
| 				Name:          "checkout: moving from B to A", | ||||
| 				Status:        models.StatusReflog, | ||||
| 				UnixTimestamp: 1643150483, | ||||
| @@ -152,7 +152,7 @@ func TestGetReflogCommits(t *testing.T) { | ||||
| 			filterAuthor: "John Doe <john@doe.com>", | ||||
| 			expectedCommits: []*models.Commit{ | ||||
| 				{ | ||||
| 					Sha:           "c3c4b66b64c97ffeecde", | ||||
| 					Hash:          "c3c4b66b64c97ffeecde", | ||||
| 					Name:          "checkout: moving from A to B", | ||||
| 					Status:        models.StatusReflog, | ||||
| 					UnixTimestamp: 1643150483, | ||||
|   | ||||
| @@ -60,24 +60,24 @@ func (self *StashCommands) Push(message string) error { | ||||
| 	return self.cmd.New(cmdArgs).Run() | ||||
| } | ||||
|  | ||||
| func (self *StashCommands) Store(sha string, message string) error { | ||||
| func (self *StashCommands) Store(hash string, message string) error { | ||||
| 	trimmedMessage := strings.Trim(message, " \t") | ||||
|  | ||||
| 	cmdArgs := NewGitCmd("stash").Arg("store"). | ||||
| 		ArgIf(trimmedMessage != "", "-m", trimmedMessage). | ||||
| 		Arg(sha). | ||||
| 		Arg(hash). | ||||
| 		ToArgv() | ||||
|  | ||||
| 	return self.cmd.New(cmdArgs).Run() | ||||
| } | ||||
|  | ||||
| func (self *StashCommands) Sha(index int) (string, error) { | ||||
| func (self *StashCommands) Hash(index int) (string, error) { | ||||
| 	cmdArgs := NewGitCmd("rev-parse"). | ||||
| 		Arg(fmt.Sprintf("refs/stash@{%d}", index)). | ||||
| 		ToArgv() | ||||
|  | ||||
| 	sha, _, err := self.cmd.New(cmdArgs).DontLog().RunWithOutputs() | ||||
| 	return strings.Trim(sha, "\r\n"), err | ||||
| 	hash, _, err := self.cmd.New(cmdArgs).DontLog().RunWithOutputs() | ||||
| 	return strings.Trim(hash, "\r\n"), err | ||||
| } | ||||
|  | ||||
| func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj { | ||||
| @@ -179,7 +179,7 @@ func (self *StashCommands) StashIncludeUntrackedChanges(message string) error { | ||||
| } | ||||
|  | ||||
| func (self *StashCommands) Rename(index int, message string) error { | ||||
| 	sha, err := self.Sha(index) | ||||
| 	hash, err := self.Hash(index) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| @@ -188,7 +188,7 @@ func (self *StashCommands) Rename(index int, message string) error { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	err = self.Store(sha, message) | ||||
| 	err = self.Store(hash, message) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -91,7 +91,7 @@ func TestStashSha(t *testing.T) { | ||||
| 		ExpectGitArgs([]string{"rev-parse", "refs/stash@{5}"}, "14d94495194651adfd5f070590df566c11d28243\n", nil) | ||||
| 	instance := buildStashCommands(commonDeps{runner: runner}) | ||||
|  | ||||
| 	sha, err := instance.Sha(5) | ||||
| 	sha, err := instance.Hash(5) | ||||
| 	assert.NoError(t, err) | ||||
| 	assert.Equal(t, "14d94495194651adfd5f070590df566c11d28243", sha) | ||||
| 	runner.CheckForMissingCalls() | ||||
|   | ||||
| @@ -43,7 +43,7 @@ const ( | ||||
|  | ||||
| // Commit : A git commit | ||||
| type Commit struct { | ||||
| 	Sha           string | ||||
| 	Hash          string | ||||
| 	Name          string | ||||
| 	Status        CommitStatus | ||||
| 	Action        todo.TodoCommand | ||||
| @@ -59,15 +59,15 @@ type Commit struct { | ||||
| } | ||||
|  | ||||
| func (c *Commit) ShortSha() string { | ||||
| 	return utils.ShortSha(c.Sha) | ||||
| 	return utils.ShortSha(c.Hash) | ||||
| } | ||||
|  | ||||
| func (c *Commit) FullRefName() string { | ||||
| 	return c.Sha | ||||
| 	return c.Hash | ||||
| } | ||||
|  | ||||
| func (c *Commit) RefName() string { | ||||
| 	return c.Sha | ||||
| 	return c.Hash | ||||
| } | ||||
|  | ||||
| func (c *Commit) ParentRefName() string { | ||||
| @@ -86,7 +86,7 @@ func (c *Commit) ID() string { | ||||
| } | ||||
|  | ||||
| func (c *Commit) Description() string { | ||||
| 	return fmt.Sprintf("%s %s", c.Sha[:7], c.Name) | ||||
| 	return fmt.Sprintf("%s %s", c.Hash[:7], c.Name) | ||||
| } | ||||
|  | ||||
| func (c *Commit) IsMerge() bool { | ||||
|   | ||||
| @@ -34,7 +34,7 @@ func NewLocalCommitsContext(c *ContextCommon) *LocalCommitsContext { | ||||
| 		if c.CurrentContext().GetKey() == LOCAL_COMMITS_CONTEXT_KEY { | ||||
| 			selectedCommit := viewModel.GetSelected() | ||||
| 			if selectedCommit != nil { | ||||
| 				selectedCommitHash = selectedCommit.Sha | ||||
| 				selectedCommitHash = selectedCommit.Hash | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| @@ -133,7 +133,7 @@ func (self *LocalCommitsContext) GetSelectedCommitHash() string { | ||||
| 	if commit == nil { | ||||
| 		return "" | ||||
| 	} | ||||
| 	return commit.Sha | ||||
| 	return commit.Hash | ||||
| } | ||||
|  | ||||
| func (self *LocalCommitsContext) SelectCommitByHash(hash string) bool { | ||||
| @@ -141,7 +141,7 @@ func (self *LocalCommitsContext) SelectCommitByHash(hash string) bool { | ||||
| 		return false | ||||
| 	} | ||||
|  | ||||
| 	if _, idx, found := lo.FindIndexOf(self.GetItems(), func(c *models.Commit) bool { return c.Sha == hash }); found { | ||||
| 	if _, idx, found := lo.FindIndexOf(self.GetItems(), func(c *models.Commit) bool { return c.Hash == hash }); found { | ||||
| 		self.SetSelection(idx) | ||||
| 		return true | ||||
| 	} | ||||
|   | ||||
| @@ -48,7 +48,7 @@ func NewSubCommitsContext( | ||||
| 		if c.CurrentContext().GetKey() == SUB_COMMITS_CONTEXT_KEY { | ||||
| 			selectedCommit := viewModel.GetSelected() | ||||
| 			if selectedCommit != nil { | ||||
| 				selectedCommitHash = selectedCommit.Sha | ||||
| 				selectedCommitHash = selectedCommit.Hash | ||||
| 			} | ||||
| 		} | ||||
| 		branches := []*models.Branch{} | ||||
|   | ||||
| @@ -171,16 +171,16 @@ func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) e | ||||
|  | ||||
| func (self *BasicCommitsController) copyCommitHashToClipboard(commit *models.Commit) error { | ||||
| 	self.c.LogAction(self.c.Tr.Actions.CopyCommitHashToClipboard) | ||||
| 	if err := self.c.OS().CopyToClipboard(commit.Sha); err != nil { | ||||
| 	if err := self.c.OS().CopyToClipboard(commit.Hash); err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
|  | ||||
| 	self.c.Toast(fmt.Sprintf("'%s' %s", commit.Sha, self.c.Tr.CopiedToClipboard)) | ||||
| 	self.c.Toast(fmt.Sprintf("'%s' %s", commit.Hash, self.c.Tr.CopiedToClipboard)) | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (self *BasicCommitsController) copyCommitURLToClipboard(commit *models.Commit) error { | ||||
| 	url, err := self.c.Helpers().Host.GetCommitURL(commit.Sha) | ||||
| 	url, err := self.c.Helpers().Host.GetCommitURL(commit.Hash) | ||||
| 	if err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
| @@ -195,7 +195,7 @@ func (self *BasicCommitsController) copyCommitURLToClipboard(commit *models.Comm | ||||
| } | ||||
|  | ||||
| func (self *BasicCommitsController) copyCommitDiffToClipboard(commit *models.Commit) error { | ||||
| 	diff, err := self.c.Git().Commit.GetCommitDiff(commit.Sha) | ||||
| 	diff, err := self.c.Git().Commit.GetCommitDiff(commit.Hash) | ||||
| 	if err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
| @@ -210,7 +210,7 @@ func (self *BasicCommitsController) copyCommitDiffToClipboard(commit *models.Com | ||||
| } | ||||
|  | ||||
| func (self *BasicCommitsController) copyAuthorToClipboard(commit *models.Commit) error { | ||||
| 	author, err := self.c.Git().Commit.GetCommitAuthor(commit.Sha) | ||||
| 	author, err := self.c.Git().Commit.GetCommitAuthor(commit.Hash) | ||||
| 	if err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
| @@ -227,7 +227,7 @@ func (self *BasicCommitsController) copyAuthorToClipboard(commit *models.Commit) | ||||
| } | ||||
|  | ||||
| func (self *BasicCommitsController) copyCommitMessageToClipboard(commit *models.Commit) error { | ||||
| 	message, err := self.c.Git().Commit.GetCommitMessage(commit.Sha) | ||||
| 	message, err := self.c.Git().Commit.GetCommitMessage(commit.Hash) | ||||
| 	if err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
| @@ -242,7 +242,7 @@ func (self *BasicCommitsController) copyCommitMessageToClipboard(commit *models. | ||||
| } | ||||
|  | ||||
| func (self *BasicCommitsController) copyCommitSubjectToClipboard(commit *models.Commit) error { | ||||
| 	message, err := self.c.Git().Commit.GetCommitSubject(commit.Sha) | ||||
| 	message, err := self.c.Git().Commit.GetCommitSubject(commit.Hash) | ||||
| 	if err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
| @@ -257,7 +257,7 @@ func (self *BasicCommitsController) copyCommitSubjectToClipboard(commit *models. | ||||
| } | ||||
|  | ||||
| func (self *BasicCommitsController) openInBrowser(commit *models.Commit) error { | ||||
| 	url, err := self.c.Helpers().Host.GetCommitURL(commit.Sha) | ||||
| 	url, err := self.c.Helpers().Host.GetCommitURL(commit.Hash) | ||||
| 	if err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
| @@ -275,7 +275,7 @@ func (self *BasicCommitsController) newBranch(commit *models.Commit) error { | ||||
| } | ||||
|  | ||||
| func (self *BasicCommitsController) createResetMenu(commit *models.Commit) error { | ||||
| 	return self.c.Helpers().Refs.CreateGitResetMenu(commit.Sha) | ||||
| 	return self.c.Helpers().Refs.CreateGitResetMenu(commit.Hash) | ||||
| } | ||||
|  | ||||
| func (self *BasicCommitsController) checkout(commit *models.Commit) error { | ||||
| @@ -284,7 +284,7 @@ func (self *BasicCommitsController) checkout(commit *models.Commit) error { | ||||
| 		Prompt: self.c.Tr.SureCheckoutThisCommit, | ||||
| 		HandleConfirm: func() error { | ||||
| 			self.c.LogAction(self.c.Tr.Actions.CheckoutCommit) | ||||
| 			return self.c.Helpers().Refs.CheckoutRef(commit.Sha, types.CheckoutRefOptions{}) | ||||
| 			return self.c.Helpers().Refs.CheckoutRef(commit.Hash, types.CheckoutRefOptions{}) | ||||
| 		}, | ||||
| 	}) | ||||
| } | ||||
| @@ -295,7 +295,7 @@ func (self *BasicCommitsController) copyRange(*models.Commit) error { | ||||
|  | ||||
| func (self *BasicCommitsController) canCopyCommits(selectedCommits []*models.Commit, startIdx int, endIdx int) *types.DisabledReason { | ||||
| 	for _, commit := range selectedCommits { | ||||
| 		if commit.Sha == "" { | ||||
| 		if commit.Hash == "" { | ||||
| 			return &types.DisabledReason{Text: self.c.Tr.CannotCherryPickNonCommit, ShowErrorInPanel: true} | ||||
| 		} | ||||
|  | ||||
|   | ||||
| @@ -69,7 +69,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c | ||||
| 	// Originally we were allowing the user to, from the bisect menu, select whether | ||||
| 	// they were talking about the selected commit or the current bisect commit, | ||||
| 	// and that was a bit confusing (and required extra keypresses). | ||||
| 	selectCurrentAfter := info.GetCurrentSha() == "" || info.GetCurrentSha() == commit.Sha | ||||
| 	selectCurrentAfter := info.GetCurrentSha() == "" || info.GetCurrentSha() == commit.Hash | ||||
| 	// we need to wait to reselect if our bisect commits aren't ancestors of our 'start' | ||||
| 	// ref, because we'll be reloading our commits in that case. | ||||
| 	waitToReselect := selectCurrentAfter && !self.c.Git().Bisect.ReachableFromStart(info) | ||||
| @@ -79,7 +79,7 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c | ||||
| 	// use the selected commit in that case. | ||||
|  | ||||
| 	bisecting := info.GetCurrentSha() != "" | ||||
| 	shaToMark := lo.Ternary(bisecting, info.GetCurrentSha(), commit.Sha) | ||||
| 	shaToMark := lo.Ternary(bisecting, info.GetCurrentSha(), commit.Hash) | ||||
| 	shortShaToMark := utils.ShortSha(shaToMark) | ||||
|  | ||||
| 	// For marking a commit as bad, when we're not already bisecting, we require | ||||
| @@ -131,12 +131,12 @@ func (self *BisectController) openMidBisectMenu(info *git_commands.BisectInfo, c | ||||
| 			Key:            's', | ||||
| 		}, | ||||
| 	} | ||||
| 	if info.GetCurrentSha() != "" && info.GetCurrentSha() != commit.Sha { | ||||
| 	if info.GetCurrentSha() != "" && info.GetCurrentSha() != commit.Hash { | ||||
| 		menuItems = append(menuItems, lo.ToPtr(types.MenuItem{ | ||||
| 			Label: fmt.Sprintf(self.c.Tr.Bisect.SkipSelected, commit.ShortSha()), | ||||
| 			OnPress: func() error { | ||||
| 				self.c.LogAction(self.c.Tr.Actions.BisectSkip) | ||||
| 				if err := self.c.Git().Bisect.Skip(commit.Sha); err != nil { | ||||
| 				if err := self.c.Git().Bisect.Skip(commit.Hash); err != nil { | ||||
| 					return self.c.Error(err) | ||||
| 				} | ||||
|  | ||||
| @@ -172,7 +172,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo, | ||||
| 						return self.c.Error(err) | ||||
| 					} | ||||
|  | ||||
| 					if err := self.c.Git().Bisect.Mark(commit.Sha, info.NewTerm()); err != nil { | ||||
| 					if err := self.c.Git().Bisect.Mark(commit.Hash, info.NewTerm()); err != nil { | ||||
| 						return self.c.Error(err) | ||||
| 					} | ||||
|  | ||||
| @@ -189,7 +189,7 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo, | ||||
| 						return self.c.Error(err) | ||||
| 					} | ||||
|  | ||||
| 					if err := self.c.Git().Bisect.Mark(commit.Sha, info.OldTerm()); err != nil { | ||||
| 					if err := self.c.Git().Bisect.Mark(commit.Hash, info.OldTerm()); err != nil { | ||||
| 						return self.c.Error(err) | ||||
| 					} | ||||
|  | ||||
| @@ -287,7 +287,7 @@ func (self *BisectController) selectCurrentBisectCommit() { | ||||
| 	if info.GetCurrentSha() != "" { | ||||
| 		// find index of commit with that sha, move cursor to that. | ||||
| 		for i, commit := range self.c.Model().Commits { | ||||
| 			if commit.Sha == info.GetCurrentSha() { | ||||
| 			if commit.Hash == info.GetCurrentSha() { | ||||
| 				self.context().SetSelection(i) | ||||
| 				_ = self.context().HandleFocus(types.OnFocusOpts{}) | ||||
| 				break | ||||
|   | ||||
| @@ -67,7 +67,7 @@ func (self *CustomPatchOptionsMenuAction) Call() error { | ||||
|  | ||||
| 		if self.c.CurrentContext().GetKey() == self.c.Contexts().LocalCommits.GetKey() { | ||||
| 			selectedCommit := self.c.Contexts().LocalCommits.GetSelected() | ||||
| 			if selectedCommit != nil && self.c.Git().Patch.PatchBuilder.To != selectedCommit.Sha { | ||||
| 			if selectedCommit != nil && self.c.Git().Patch.PatchBuilder.To != selectedCommit.Hash { | ||||
|  | ||||
| 				var disabledReason *types.DisabledReason | ||||
| 				if self.c.Contexts().LocalCommits.AreMultipleItemsSelected() { | ||||
| @@ -80,7 +80,7 @@ func (self *CustomPatchOptionsMenuAction) Call() error { | ||||
| 					append( | ||||
| 						[]*types.MenuItem{ | ||||
| 							{ | ||||
| 								Label:          fmt.Sprintf(self.c.Tr.MovePatchToSelectedCommit, selectedCommit.Sha), | ||||
| 								Label:          fmt.Sprintf(self.c.Tr.MovePatchToSelectedCommit, selectedCommit.Hash), | ||||
| 								Tooltip:        self.c.Tr.MovePatchToSelectedCommitTooltip, | ||||
| 								OnPress:        self.handleMovePatchToSelectedCommit, | ||||
| 								Key:            'm', | ||||
| @@ -106,7 +106,7 @@ func (self *CustomPatchOptionsMenuAction) Call() error { | ||||
|  | ||||
| func (self *CustomPatchOptionsMenuAction) getPatchCommitIndex() int { | ||||
| 	for index, commit := range self.c.Model().Commits { | ||||
| 		if commit.Sha == self.c.Git().Patch.PatchBuilder.To { | ||||
| 		if commit.Hash == self.c.Git().Patch.PatchBuilder.To { | ||||
| 			return index | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
| @@ -41,7 +41,7 @@ func (self *CherryPickHelper) CopyRange(commitsList []*models.Commit, context ty | ||||
| 	commitSet := self.getData().SelectedShaSet() | ||||
|  | ||||
| 	allCommitsCopied := lo.EveryBy(commitsList[startIdx:endIdx+1], func(commit *models.Commit) bool { | ||||
| 		return commitSet.Includes(commit.Sha) | ||||
| 		return commitSet.Includes(commit.Hash) | ||||
| 	}) | ||||
|  | ||||
| 	// if all selected commits are already copied, we'll uncopy them | ||||
|   | ||||
| @@ -62,7 +62,7 @@ func (self *FixupHelper) HandleFindBaseCommitForFixupPress() error { | ||||
| 	} | ||||
|  | ||||
| 	commit, index, ok := lo.FindIndexOf(self.c.Model().Commits, func(commit *models.Commit) bool { | ||||
| 		return commit.Sha == shas[0] | ||||
| 		return commit.Hash == shas[0] | ||||
| 	}) | ||||
| 	if !ok { | ||||
| 		commits := self.c.Model().Commits | ||||
|   | ||||
| @@ -285,7 +285,7 @@ func (self *LocalCommitsController) GetOnRenderToMain() func() error { | ||||
| 							"ref": strings.TrimPrefix(commit.Name, "refs/heads/"), | ||||
| 						})) | ||||
| 			} else { | ||||
| 				cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath()) | ||||
| 				cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Hash, self.c.Modes().Filtering.GetPath()) | ||||
| 				task = types.NewRunPtyTask(cmdObj.GetCmd()) | ||||
| 			} | ||||
|  | ||||
| @@ -350,7 +350,7 @@ func (self *LocalCommitsController) fixup(selectedCommits []*models.Commit, star | ||||
| } | ||||
|  | ||||
| func (self *LocalCommitsController) reword(commit *models.Commit) error { | ||||
| 	commitMessage, err := self.c.Git().Commit.GetCommitMessage(commit.Sha) | ||||
| 	commitMessage, err := self.c.Git().Commit.GetCommitMessage(commit.Hash) | ||||
| 	if err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
| @@ -508,9 +508,9 @@ func (self *LocalCommitsController) startInteractiveRebaseWithEdit( | ||||
| 		self.c.LogAction(self.c.Tr.Actions.EditCommit) | ||||
| 		selectedIdx, rangeStartIdx, rangeSelectMode := self.context().GetSelectionRangeAndMode() | ||||
| 		commits := self.c.Model().Commits | ||||
| 		selectedSha := commits[selectedIdx].Sha | ||||
| 		rangeStartSha := commits[rangeStartIdx].Sha | ||||
| 		err := self.c.Git().Rebase.EditRebase(commitsToEdit[len(commitsToEdit)-1].Sha) | ||||
| 		selectedSha := commits[selectedIdx].Hash | ||||
| 		rangeStartSha := commits[rangeStartIdx].Hash | ||||
| 		err := self.c.Git().Rebase.EditRebase(commitsToEdit[len(commitsToEdit)-1].Hash) | ||||
| 		return self.c.Helpers().MergeAndRebase.CheckMergeOrRebaseWithRefreshOptions( | ||||
| 			err, | ||||
| 			types.RefreshOptions{Mode: types.BLOCK_UI, Then: func() { | ||||
| @@ -518,7 +518,7 @@ func (self *LocalCommitsController) startInteractiveRebaseWithEdit( | ||||
| 				for _, c := range commitsToEdit[:len(commitsToEdit)-1] { | ||||
| 					// Merge commits can't be set to "edit", so just skip them | ||||
| 					if !c.IsMerge() { | ||||
| 						todos = append(todos, &models.Commit{Sha: c.Sha, Action: todo.Pick}) | ||||
| 						todos = append(todos, &models.Commit{Hash: c.Hash, Action: todo.Pick}) | ||||
| 					} | ||||
| 				} | ||||
| 				if len(todos) > 0 { | ||||
| @@ -532,10 +532,10 @@ func (self *LocalCommitsController) startInteractiveRebaseWithEdit( | ||||
| 				// new lines can be added for update-ref commands in the TODO file, due to | ||||
| 				// stacked branches. So the selected commits may be in different positions in the list. | ||||
| 				_, newSelectedIdx, ok1 := lo.FindIndexOf(self.c.Model().Commits, func(c *models.Commit) bool { | ||||
| 					return c.Sha == selectedSha | ||||
| 					return c.Hash == selectedSha | ||||
| 				}) | ||||
| 				_, newRangeStartIdx, ok2 := lo.FindIndexOf(self.c.Model().Commits, func(c *models.Commit) bool { | ||||
| 					return c.Sha == rangeStartSha | ||||
| 					return c.Hash == rangeStartSha | ||||
| 				}) | ||||
| 				if ok1 && ok2 { | ||||
| 					self.context().SetSelectionRangeAndMode(newSelectedIdx, newRangeStartIdx, rangeSelectMode) | ||||
| @@ -787,7 +787,7 @@ func (self *LocalCommitsController) revert(commit *models.Commit) error { | ||||
| 			HandleConfirm: func() error { | ||||
| 				self.c.LogAction(self.c.Tr.Actions.RevertCommit) | ||||
| 				return self.c.WithWaitingStatusSync(self.c.Tr.RevertingStatus, func() error { | ||||
| 					if err := self.c.Git().Commit.Revert(commit.Sha); err != nil { | ||||
| 					if err := self.c.Git().Commit.Revert(commit.Hash); err != nil { | ||||
| 						return err | ||||
| 					} | ||||
| 					return self.afterRevertCommit() | ||||
| @@ -812,7 +812,7 @@ func (self *LocalCommitsController) createRevertMergeCommitMenu(commit *models.C | ||||
| 				parentNumber := i + 1 | ||||
| 				self.c.LogAction(self.c.Tr.Actions.RevertCommit) | ||||
| 				return self.c.WithWaitingStatusSync(self.c.Tr.RevertingStatus, func() error { | ||||
| 					if err := self.c.Git().Commit.RevertMerge(commit.Sha, parentNumber); err != nil { | ||||
| 					if err := self.c.Git().Commit.RevertMerge(commit.Hash, parentNumber); err != nil { | ||||
| 						return err | ||||
| 					} | ||||
| 					return self.afterRevertCommit() | ||||
| @@ -850,7 +850,7 @@ func (self *LocalCommitsController) createFixupCommit(commit *models.Commit) err | ||||
| 					return self.c.Helpers().WorkingTree.WithEnsureCommitableFiles(func() error { | ||||
| 						self.c.LogAction(self.c.Tr.Actions.CreateFixupCommit) | ||||
| 						return self.c.WithWaitingStatusSync(self.c.Tr.CreatingFixupCommitStatus, func() error { | ||||
| 							if err := self.c.Git().Commit.CreateFixupCommit(commit.Sha); err != nil { | ||||
| 							if err := self.c.Git().Commit.CreateFixupCommit(commit.Hash); err != nil { | ||||
| 								return self.c.Error(err) | ||||
| 							} | ||||
|  | ||||
| @@ -884,7 +884,7 @@ func (self *LocalCommitsController) createFixupCommit(commit *models.Commit) err | ||||
| } | ||||
|  | ||||
| func (self *LocalCommitsController) createAmendCommit(commit *models.Commit, includeFileChanges bool) error { | ||||
| 	commitMessage, err := self.c.Git().Commit.GetCommitMessage(commit.Sha) | ||||
| 	commitMessage, err := self.c.Git().Commit.GetCommitMessage(commit.Hash) | ||||
| 	if err != nil { | ||||
| 		return self.c.Error(err) | ||||
| 	} | ||||
| @@ -1024,7 +1024,7 @@ func isFixupCommit(subject string) (string, bool) { | ||||
| } | ||||
|  | ||||
| func (self *LocalCommitsController) createTag(commit *models.Commit) error { | ||||
| 	return self.c.Helpers().Tags.OpenCreateTagPrompt(commit.Sha, func() {}) | ||||
| 	return self.c.Helpers().Tags.OpenCreateTagPrompt(commit.Hash, func() {}) | ||||
| } | ||||
|  | ||||
| func (self *LocalCommitsController) openSearch() error { | ||||
| @@ -1181,11 +1181,11 @@ func (self *LocalCommitsController) canPaste() *types.DisabledReason { | ||||
| } | ||||
|  | ||||
| func (self *LocalCommitsController) markAsBaseCommit(commit *models.Commit) error { | ||||
| 	if commit.Sha == self.c.Modes().MarkedBaseCommit.GetSha() { | ||||
| 	if commit.Hash == self.c.Modes().MarkedBaseCommit.GetSha() { | ||||
| 		// Reset when invoking it again on the marked commit | ||||
| 		self.c.Modes().MarkedBaseCommit.SetSha("") | ||||
| 	} else { | ||||
| 		self.c.Modes().MarkedBaseCommit.SetSha(commit.Sha) | ||||
| 		self.c.Modes().MarkedBaseCommit.SetSha(commit.Hash) | ||||
| 	} | ||||
| 	return self.c.PostRefreshUpdate(self.c.Contexts().LocalCommits) | ||||
| } | ||||
|   | ||||
| @@ -45,7 +45,7 @@ func (self *ReflogCommitsController) GetOnRenderToMain() func() error { | ||||
| 			if commit == nil { | ||||
| 				task = types.NewRenderStringTask("No reflog history") | ||||
| 			} else { | ||||
| 				cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath()) | ||||
| 				cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Hash, self.c.Modes().Filtering.GetPath()) | ||||
|  | ||||
| 				task = types.NewRunPtyTask(cmdObj.GetCmd()) | ||||
| 			} | ||||
|   | ||||
| @@ -46,7 +46,7 @@ func (self *SubCommitsController) GetOnRenderToMain() func() error { | ||||
| 			if commit == nil { | ||||
| 				task = types.NewRenderStringTask("No commits") | ||||
| 			} else { | ||||
| 				cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Sha, self.c.Modes().Filtering.GetPath()) | ||||
| 				cmdObj := self.c.Git().Commit.ShowCmdObj(commit.Hash, self.c.Modes().Filtering.GetPath()) | ||||
|  | ||||
| 				task = types.NewRunPtyTask(cmdObj.GetCmd()) | ||||
| 			} | ||||
|   | ||||
| @@ -188,7 +188,7 @@ func (self *UndoController) parseReflogForActions(onUserAction func(counter int, | ||||
|  | ||||
| 		prevCommitHash := "" | ||||
| 		if len(reflogCommits)-1 >= reflogCommitIdx+1 { | ||||
| 			prevCommitHash = reflogCommits[reflogCommitIdx+1].Sha | ||||
| 			prevCommitHash = reflogCommits[reflogCommitIdx+1].Hash | ||||
| 		} | ||||
|  | ||||
| 		if rebaseFinishCommitHash == "" { | ||||
| @@ -197,11 +197,11 @@ func (self *UndoController) parseReflogForActions(onUserAction func(counter int, | ||||
| 			} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^\[lazygit redo\]`); ok { | ||||
| 				counter-- | ||||
| 			} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(abort\)|^rebase (-i )?\(finish\)`); ok { | ||||
| 				rebaseFinishCommitHash = reflogCommit.Sha | ||||
| 				rebaseFinishCommitHash = reflogCommit.Hash | ||||
| 			} else if ok, match := utils.FindStringSubmatch(reflogCommit.Name, `^checkout: moving from ([\S]+) to ([\S]+)`); ok { | ||||
| 				action = &reflogAction{kind: CHECKOUT, from: match[1], to: match[2]} | ||||
| 			} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^commit|^reset: moving to|^pull`); ok { | ||||
| 				action = &reflogAction{kind: COMMIT, from: prevCommitHash, to: reflogCommit.Sha} | ||||
| 				action = &reflogAction{kind: COMMIT, from: prevCommitHash, to: reflogCommit.Hash} | ||||
| 			} else if ok, _ := utils.FindStringSubmatch(reflogCommit.Name, `^rebase (-i )?\(start\)`); ok { | ||||
| 				// if we're here then we must be currently inside an interactive rebase | ||||
| 				action = &reflogAction{kind: CURRENT_REBASE, from: prevCommitHash} | ||||
|   | ||||
| @@ -26,31 +26,31 @@ func (self *CherryPicking) Active() bool { | ||||
|  | ||||
| func (self *CherryPicking) SelectedShaSet() *set.Set[string] { | ||||
| 	shas := lo.Map(self.CherryPickedCommits, func(commit *models.Commit, _ int) string { | ||||
| 		return commit.Sha | ||||
| 		return commit.Hash | ||||
| 	}) | ||||
| 	return set.NewFromSlice(shas) | ||||
| } | ||||
|  | ||||
| func (self *CherryPicking) Add(selectedCommit *models.Commit, commitsList []*models.Commit) { | ||||
| 	commitSet := self.SelectedShaSet() | ||||
| 	commitSet.Add(selectedCommit.Sha) | ||||
| 	commitSet.Add(selectedCommit.Hash) | ||||
|  | ||||
| 	self.update(commitSet, commitsList) | ||||
| } | ||||
|  | ||||
| func (self *CherryPicking) Remove(selectedCommit *models.Commit, commitsList []*models.Commit) { | ||||
| 	commitSet := self.SelectedShaSet() | ||||
| 	commitSet.Remove(selectedCommit.Sha) | ||||
| 	commitSet.Remove(selectedCommit.Hash) | ||||
|  | ||||
| 	self.update(commitSet, commitsList) | ||||
| } | ||||
|  | ||||
| func (self *CherryPicking) update(selectedShaSet *set.Set[string], commitsList []*models.Commit) { | ||||
| 	cherryPickedCommits := lo.Filter(commitsList, func(commit *models.Commit, _ int) bool { | ||||
| 		return selectedShaSet.Includes(commit.Sha) | ||||
| 		return selectedShaSet.Includes(commit.Hash) | ||||
| 	}) | ||||
|  | ||||
| 	self.CherryPickedCommits = lo.Map(cherryPickedCommits, func(commit *models.Commit, _ int) *models.Commit { | ||||
| 		return &models.Commit{Name: commit.Name, Sha: commit.Sha} | ||||
| 		return &models.Commit{Name: commit.Name, Hash: commit.Hash} | ||||
| 	}) | ||||
| } | ||||
|   | ||||
| @@ -123,7 +123,7 @@ func GetCommitListDisplayStrings( | ||||
| 					!lo.Contains(common.UserConfig.Git.MainBranches, b.Name) && | ||||
| 					// Don't show a marker for the head commit unless the | ||||
| 					// rebase.updateRefs config is on | ||||
| 					(hasRebaseUpdateRefsConfig || b.CommitHash != commits[0].Sha) | ||||
| 					(hasRebaseUpdateRefsConfig || b.CommitHash != commits[0].Hash) | ||||
| 		})) | ||||
|  | ||||
| 	lines := make([][]string, 0, len(filteredCommits)) | ||||
| @@ -131,13 +131,13 @@ func GetCommitListDisplayStrings( | ||||
| 	willBeRebased := markedBaseCommit == "" | ||||
| 	for i, commit := range filteredCommits { | ||||
| 		unfilteredIdx := i + startIdx | ||||
| 		bisectStatus = getBisectStatus(unfilteredIdx, commit.Sha, bisectInfo, bisectBounds) | ||||
| 		bisectStatus = getBisectStatus(unfilteredIdx, commit.Hash, bisectInfo, bisectBounds) | ||||
| 		isYouAreHereCommit := false | ||||
| 		if showYouAreHereLabel && (commit.Action == models.ActionConflict || unfilteredIdx == rebaseOffset) { | ||||
| 			isYouAreHereCommit = true | ||||
| 			showYouAreHereLabel = false | ||||
| 		} | ||||
| 		isMarkedBaseCommit := commit.Sha != "" && commit.Sha == markedBaseCommit | ||||
| 		isMarkedBaseCommit := commit.Hash != "" && commit.Hash == markedBaseCommit | ||||
| 		if isMarkedBaseCommit { | ||||
| 			willBeRebased = true | ||||
| 		} | ||||
| @@ -172,11 +172,11 @@ func getbisectBounds(commits []*models.Commit, bisectInfo *git_commands.BisectIn | ||||
| 	bisectBounds := &bisectBounds{} | ||||
|  | ||||
| 	for i, commit := range commits { | ||||
| 		if commit.Sha == bisectInfo.GetNewSha() { | ||||
| 		if commit.Hash == bisectInfo.GetNewSha() { | ||||
| 			bisectBounds.newIndex = i | ||||
| 		} | ||||
|  | ||||
| 		status, ok := bisectInfo.Status(commit.Sha) | ||||
| 		status, ok := bisectInfo.Status(commit.Hash) | ||||
| 		if ok && status == git_commands.BisectStatusOld { | ||||
| 			bisectBounds.oldIndex = i | ||||
| 			return bisectBounds | ||||
| @@ -203,7 +203,7 @@ func loadPipesets(commits []*models.Commit) [][]*graph.Pipe { | ||||
| 	// given that our cache key is a commit hash and a commit count, it's very important that we don't actually try to render pipes | ||||
| 	// when dealing with things like filtered commits. | ||||
| 	cacheKey := pipeSetCacheKey{ | ||||
| 		commitHash:  commits[0].Sha, | ||||
| 		commitHash:  commits[0].Hash, | ||||
| 		commitCount: len(commits), | ||||
| 	} | ||||
|  | ||||
| @@ -331,7 +331,7 @@ func displayCommit( | ||||
| 			tagString = theme.DiffTerminalColor.SetBold().Sprint(strings.Join(commit.Tags, " ")) + " " | ||||
| 		} | ||||
|  | ||||
| 		if branchHeadsToVisualize.Includes(commit.Sha) && | ||||
| 		if branchHeadsToVisualize.Includes(commit.Hash) && | ||||
| 			// Don't show branch head on commits that are already merged to a main branch | ||||
| 			commit.Status != models.StatusMerged && | ||||
| 			// Don't show branch head on a "pick" todo if the rebase.updateRefs config is on | ||||
| @@ -421,7 +421,7 @@ func getShaColor( | ||||
| 		return getBisectStatusColor(bisectStatus) | ||||
| 	} | ||||
|  | ||||
| 	diffed := commit.Sha != "" && commit.Sha == diffName | ||||
| 	diffed := commit.Hash != "" && commit.Hash == diffName | ||||
| 	shaColor := theme.DefaultTextColor | ||||
| 	switch commit.Status { | ||||
| 	case models.StatusUnpushed: | ||||
| @@ -439,7 +439,7 @@ func getShaColor( | ||||
|  | ||||
| 	if diffed { | ||||
| 		shaColor = theme.DiffTerminalColor | ||||
| 	} else if cherryPickedCommitHashSet.Includes(commit.Sha) { | ||||
| 	} else if cherryPickedCommitHashSet.Includes(commit.Hash) { | ||||
| 		shaColor = theme.CherryPickedCommitTextStyle | ||||
| 	} else if commit.Divergence == models.DivergenceRight && commit.Status != models.StatusMerged { | ||||
| 		shaColor = style.FgBlue | ||||
|   | ||||
| @@ -58,8 +58,8 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "some commits", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1"}, | ||||
| 				{Name: "commit2", Sha: "sha2"}, | ||||
| 				{Name: "commit1", Hash: "sha1"}, | ||||
| 				{Name: "commit2", Hash: "sha2"}, | ||||
| 			}, | ||||
| 			startIdx:                  0, | ||||
| 			endIdx:                    2, | ||||
| @@ -75,8 +75,8 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "commit with tags", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Tags: []string{"tag1", "tag2"}}, | ||||
| 				{Name: "commit2", Sha: "sha2"}, | ||||
| 				{Name: "commit1", Hash: "sha1", Tags: []string{"tag1", "tag2"}}, | ||||
| 				{Name: "commit2", Hash: "sha2"}, | ||||
| 			}, | ||||
| 			startIdx:                  0, | ||||
| 			endIdx:                    2, | ||||
| @@ -92,10 +92,10 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "show local branch head, except the current branch, main branches, or merged branches", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1"}, | ||||
| 				{Name: "commit2", Sha: "sha2"}, | ||||
| 				{Name: "commit3", Sha: "sha3"}, | ||||
| 				{Name: "commit4", Sha: "sha4", Status: models.StatusMerged}, | ||||
| 				{Name: "commit1", Hash: "sha1"}, | ||||
| 				{Name: "commit2", Hash: "sha2"}, | ||||
| 				{Name: "commit3", Hash: "sha3"}, | ||||
| 				{Name: "commit4", Hash: "sha4", Status: models.StatusMerged}, | ||||
| 			}, | ||||
| 			branches: []*models.Branch{ | ||||
| 				{Name: "current-branch", CommitHash: "sha1", Head: true}, | ||||
| @@ -121,8 +121,8 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "show local branch head for head commit if updateRefs is on", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1"}, | ||||
| 				{Name: "commit2", Sha: "sha2"}, | ||||
| 				{Name: "commit1", Hash: "sha1"}, | ||||
| 				{Name: "commit2", Hash: "sha2"}, | ||||
| 			}, | ||||
| 			branches: []*models.Branch{ | ||||
| 				{Name: "current-branch", CommitHash: "sha1", Head: true}, | ||||
| @@ -144,8 +144,8 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "don't show local branch head for head commit if updateRefs is off", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1"}, | ||||
| 				{Name: "commit2", Sha: "sha2"}, | ||||
| 				{Name: "commit1", Hash: "sha1"}, | ||||
| 				{Name: "commit2", Hash: "sha2"}, | ||||
| 			}, | ||||
| 			branches: []*models.Branch{ | ||||
| 				{Name: "current-branch", CommitHash: "sha1", Head: true}, | ||||
| @@ -167,9 +167,9 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "show local branch head and tag if both exist", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1"}, | ||||
| 				{Name: "commit2", Sha: "sha2", Tags: []string{"some-tag"}}, | ||||
| 				{Name: "commit3", Sha: "sha3"}, | ||||
| 				{Name: "commit1", Hash: "sha1"}, | ||||
| 				{Name: "commit2", Hash: "sha2", Tags: []string{"some-tag"}}, | ||||
| 				{Name: "commit3", Hash: "sha3"}, | ||||
| 			}, | ||||
| 			branches: []*models.Branch{ | ||||
| 				{Name: "some-branch", CommitHash: "sha2"}, | ||||
| @@ -189,11 +189,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "showing graph", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}}, | ||||
| 				{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}}, | ||||
| 				{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}}, | ||||
| 				{Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}}, | ||||
| 				{Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}}, | ||||
| 				{Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, | ||||
| 			}, | ||||
| 			startIdx:                  0, | ||||
| 			endIdx:                    5, | ||||
| @@ -212,11 +212,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "showing graph, including rebase commits", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}}, | ||||
| 				{Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, | ||||
| 			}, | ||||
| 			startIdx:                  0, | ||||
| 			endIdx:                    5, | ||||
| @@ -236,11 +236,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "showing graph, including rebase commits, with offset", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}}, | ||||
| 				{Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, | ||||
| 			}, | ||||
| 			startIdx:                  1, | ||||
| 			endIdx:                    5, | ||||
| @@ -259,11 +259,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "startIdx is past TODO commits", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}}, | ||||
| 				{Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, | ||||
| 			}, | ||||
| 			startIdx:                  3, | ||||
| 			endIdx:                    5, | ||||
| @@ -280,11 +280,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "only showing TODO commits", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}}, | ||||
| 				{Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, | ||||
| 			}, | ||||
| 			startIdx:                  0, | ||||
| 			endIdx:                    2, | ||||
| @@ -301,11 +301,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "no TODO commits, towards bottom", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}}, | ||||
| 				{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}}, | ||||
| 				{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}}, | ||||
| 				{Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}}, | ||||
| 				{Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}}, | ||||
| 				{Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}}, | ||||
| 				{Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, | ||||
| 			}, | ||||
| 			startIdx:                  4, | ||||
| 			endIdx:                    5, | ||||
| @@ -321,11 +321,11 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "only TODO commits except last", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}, Action: todo.Pick}, | ||||
| 				{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}, Action: todo.Pick}, | ||||
| 				{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}}, | ||||
| 				{Name: "commit1", Hash: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}, Action: todo.Pick}, | ||||
| 				{Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}, Action: todo.Pick}, | ||||
| 				{Name: "commit4", Hash: "sha4", Parents: []string{"sha5"}, Action: todo.Pick}, | ||||
| 				{Name: "commit5", Hash: "sha5", Parents: []string{"sha7"}}, | ||||
| 			}, | ||||
| 			startIdx:                  0, | ||||
| 			endIdx:                    2, | ||||
| @@ -342,9 +342,9 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "don't show YOU ARE HERE label when not asked for (e.g. in branches panel)", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", Parents: []string{"sha2"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}}, | ||||
| 				{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}}, | ||||
| 				{Name: "commit1", Hash: "sha1", Parents: []string{"sha2"}, Action: todo.Pick}, | ||||
| 				{Name: "commit2", Hash: "sha2", Parents: []string{"sha3"}}, | ||||
| 				{Name: "commit3", Hash: "sha3", Parents: []string{"sha4"}}, | ||||
| 			}, | ||||
| 			startIdx:                  0, | ||||
| 			endIdx:                    3, | ||||
| @@ -362,8 +362,8 @@ func TestGetCommitListDisplayStrings(t *testing.T) { | ||||
| 		{ | ||||
| 			testName: "custom time format", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Name: "commit1", Sha: "sha1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"}, | ||||
| 				{Name: "commit2", Sha: "sha2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"}, | ||||
| 				{Name: "commit1", Hash: "sha1", UnixTimestamp: 1577844184, AuthorName: "Jesse Duffield"}, | ||||
| 				{Name: "commit2", Hash: "sha2", UnixTimestamp: 1576844184, AuthorName: "Jesse Duffield"}, | ||||
| 			}, | ||||
| 			fullDescription:           true, | ||||
| 			timeFormat:                "2006-01-02", | ||||
|   | ||||
| @@ -22,19 +22,19 @@ const ( | ||||
| ) | ||||
|  | ||||
| type Pipe struct { | ||||
| 	fromPos int | ||||
| 	toPos   int | ||||
| 	fromSha string | ||||
| 	toSha   string | ||||
| 	kind    PipeKind | ||||
| 	style   style.TextStyle | ||||
| 	fromPos  int | ||||
| 	toPos    int | ||||
| 	fromHash string | ||||
| 	toHash   string | ||||
| 	kind     PipeKind | ||||
| 	style    style.TextStyle | ||||
| } | ||||
|  | ||||
| var highlightStyle = style.FgLightWhite.SetBold() | ||||
|  | ||||
| func ContainsCommitHash(pipes []*Pipe, sha string) bool { | ||||
| 	for _, pipe := range pipes { | ||||
| 		if equalHashes(pipe.fromSha, sha) { | ||||
| 		if equalHashes(pipe.fromHash, sha) { | ||||
| 			return true | ||||
| 		} | ||||
| 	} | ||||
| @@ -65,7 +65,7 @@ func GetPipeSets(commits []*models.Commit, getStyle func(c *models.Commit) style | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	pipes := []*Pipe{{fromPos: 0, toPos: 0, fromSha: "START", toSha: commits[0].Sha, kind: STARTS, style: style.FgDefault}} | ||||
| 	pipes := []*Pipe{{fromPos: 0, toPos: 0, fromHash: "START", toHash: commits[0].Hash, kind: STARTS, style: style.FgDefault}} | ||||
|  | ||||
| 	return lo.Map(commits, func(commit *models.Commit, _ int) []*Pipe { | ||||
| 		pipes = getNextPipes(pipes, commit, getStyle) | ||||
| @@ -130,7 +130,7 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod | ||||
| 	// (this only happens when we're doing `git log --all`). These will be tacked onto the far end. | ||||
| 	pos := maxPos + 1 | ||||
| 	for _, pipe := range currentPipes { | ||||
| 		if equalHashes(pipe.toSha, commit.Sha) { | ||||
| 		if equalHashes(pipe.toHash, commit.Hash) { | ||||
| 			// turns out this commit does have a descendant so we'll place it right under the first instance | ||||
| 			pos = pipe.toPos | ||||
| 			break | ||||
| @@ -144,27 +144,27 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod | ||||
|  | ||||
| 	if len(commit.Parents) > 0 { // merge commit | ||||
| 		newPipes = append(newPipes, &Pipe{ | ||||
| 			fromPos: pos, | ||||
| 			toPos:   pos, | ||||
| 			fromSha: commit.Sha, | ||||
| 			toSha:   commit.Parents[0], | ||||
| 			kind:    STARTS, | ||||
| 			style:   getStyle(commit), | ||||
| 			fromPos:  pos, | ||||
| 			toPos:    pos, | ||||
| 			fromHash: commit.Hash, | ||||
| 			toHash:   commit.Parents[0], | ||||
| 			kind:     STARTS, | ||||
| 			style:    getStyle(commit), | ||||
| 		}) | ||||
| 	} else if len(commit.Parents) == 0 { // root commit | ||||
| 		newPipes = append(newPipes, &Pipe{ | ||||
| 			fromPos: pos, | ||||
| 			toPos:   pos, | ||||
| 			fromSha: commit.Sha, | ||||
| 			toSha:   models.EmptyTreeCommitHash, | ||||
| 			kind:    STARTS, | ||||
| 			style:   getStyle(commit), | ||||
| 			fromPos:  pos, | ||||
| 			toPos:    pos, | ||||
| 			fromHash: commit.Hash, | ||||
| 			toHash:   models.EmptyTreeCommitHash, | ||||
| 			kind:     STARTS, | ||||
| 			style:    getStyle(commit), | ||||
| 		}) | ||||
| 	} | ||||
|  | ||||
| 	traversedSpotsForContinuingPipes := set.New[int]() | ||||
| 	for _, pipe := range currentPipes { | ||||
| 		if !equalHashes(pipe.toSha, commit.Sha) { | ||||
| 		if !equalHashes(pipe.toHash, commit.Hash) { | ||||
| 			traversedSpotsForContinuingPipes.Add(pipe.toPos) | ||||
| 		} | ||||
| 	} | ||||
| @@ -203,27 +203,27 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod | ||||
| 	} | ||||
|  | ||||
| 	for _, pipe := range currentPipes { | ||||
| 		if equalHashes(pipe.toSha, commit.Sha) { | ||||
| 		if equalHashes(pipe.toHash, commit.Hash) { | ||||
| 			// terminating here | ||||
| 			newPipes = append(newPipes, &Pipe{ | ||||
| 				fromPos: pipe.toPos, | ||||
| 				toPos:   pos, | ||||
| 				fromSha: pipe.fromSha, | ||||
| 				toSha:   pipe.toSha, | ||||
| 				kind:    TERMINATES, | ||||
| 				style:   pipe.style, | ||||
| 				fromPos:  pipe.toPos, | ||||
| 				toPos:    pos, | ||||
| 				fromHash: pipe.fromHash, | ||||
| 				toHash:   pipe.toHash, | ||||
| 				kind:     TERMINATES, | ||||
| 				style:    pipe.style, | ||||
| 			}) | ||||
| 			traverse(pipe.toPos, pos) | ||||
| 		} else if pipe.toPos < pos { | ||||
| 			// continuing here | ||||
| 			availablePos := getNextAvailablePosForContinuingPipe() | ||||
| 			newPipes = append(newPipes, &Pipe{ | ||||
| 				fromPos: pipe.toPos, | ||||
| 				toPos:   availablePos, | ||||
| 				fromSha: pipe.fromSha, | ||||
| 				toSha:   pipe.toSha, | ||||
| 				kind:    CONTINUES, | ||||
| 				style:   pipe.style, | ||||
| 				fromPos:  pipe.toPos, | ||||
| 				toPos:    availablePos, | ||||
| 				fromHash: pipe.fromHash, | ||||
| 				toHash:   pipe.toHash, | ||||
| 				kind:     CONTINUES, | ||||
| 				style:    pipe.style, | ||||
| 			}) | ||||
| 			traverse(pipe.toPos, availablePos) | ||||
| 		} | ||||
| @@ -234,12 +234,12 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod | ||||
| 			availablePos := getNextAvailablePosForNewPipe() | ||||
| 			// need to act as if continuing pipes are going to continue on the same line. | ||||
| 			newPipes = append(newPipes, &Pipe{ | ||||
| 				fromPos: pos, | ||||
| 				toPos:   availablePos, | ||||
| 				fromSha: commit.Sha, | ||||
| 				toSha:   parent, | ||||
| 				kind:    STARTS, | ||||
| 				style:   getStyle(commit), | ||||
| 				fromPos:  pos, | ||||
| 				toPos:    availablePos, | ||||
| 				fromHash: commit.Hash, | ||||
| 				toHash:   parent, | ||||
| 				kind:     STARTS, | ||||
| 				style:    getStyle(commit), | ||||
| 			}) | ||||
|  | ||||
| 			takenSpots.Add(availablePos) | ||||
| @@ -247,7 +247,7 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod | ||||
| 	} | ||||
|  | ||||
| 	for _, pipe := range currentPipes { | ||||
| 		if !equalHashes(pipe.toSha, commit.Sha) && pipe.toPos > pos { | ||||
| 		if !equalHashes(pipe.toHash, commit.Hash) && pipe.toPos > pos { | ||||
| 			// continuing on, potentially moving left to fill in a blank spot | ||||
| 			last := pipe.toPos | ||||
| 			for i := pipe.toPos; i > pos; i-- { | ||||
| @@ -258,12 +258,12 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod | ||||
| 				} | ||||
| 			} | ||||
| 			newPipes = append(newPipes, &Pipe{ | ||||
| 				fromPos: pipe.toPos, | ||||
| 				toPos:   last, | ||||
| 				fromSha: pipe.fromSha, | ||||
| 				toSha:   pipe.toSha, | ||||
| 				kind:    CONTINUES, | ||||
| 				style:   pipe.style, | ||||
| 				fromPos:  pipe.toPos, | ||||
| 				toPos:    last, | ||||
| 				fromHash: pipe.fromHash, | ||||
| 				toHash:   pipe.toHash, | ||||
| 				kind:     CONTINUES, | ||||
| 				style:    pipe.style, | ||||
| 			}) | ||||
| 			traverse(pipe.toPos, last) | ||||
| 		} | ||||
| @@ -329,10 +329,10 @@ func renderPipeSet( | ||||
| 	// we don't want to highlight two commits if they're contiguous. We only want | ||||
| 	// to highlight multiple things if there's an actual visible pipe involved. | ||||
| 	highlight := true | ||||
| 	if prevCommit != nil && equalHashes(prevCommit.Sha, selectedCommitHash) { | ||||
| 	if prevCommit != nil && equalHashes(prevCommit.Hash, selectedCommitHash) { | ||||
| 		highlight = false | ||||
| 		for _, pipe := range pipes { | ||||
| 			if equalHashes(pipe.fromSha, selectedCommitHash) && (pipe.kind != TERMINATES || pipe.fromPos != pipe.toPos) { | ||||
| 			if equalHashes(pipe.fromHash, selectedCommitHash) && (pipe.kind != TERMINATES || pipe.fromPos != pipe.toPos) { | ||||
| 				highlight = true | ||||
| 			} | ||||
| 		} | ||||
| @@ -341,7 +341,7 @@ func renderPipeSet( | ||||
| 	// so we have our commit pos again, now it's time to build the cells. | ||||
| 	// we'll handle the one that's sourced from our selected commit last so that it can override the other cells. | ||||
| 	selectedPipes, nonSelectedPipes := utils.Partition(pipes, func(pipe *Pipe) bool { | ||||
| 		return highlight && equalHashes(pipe.fromSha, selectedCommitHash) | ||||
| 		return highlight && equalHashes(pipe.fromHash, selectedCommitHash) | ||||
| 	}) | ||||
|  | ||||
| 	for _, pipe := range nonSelectedPipes { | ||||
|   | ||||
| @@ -24,20 +24,20 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "with some merges", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"3"}}, | ||||
| 				{Sha: "3", Parents: []string{"4"}}, | ||||
| 				{Sha: "4", Parents: []string{"5", "7"}}, | ||||
| 				{Sha: "7", Parents: []string{"5"}}, | ||||
| 				{Sha: "5", Parents: []string{"8"}}, | ||||
| 				{Sha: "8", Parents: []string{"9"}}, | ||||
| 				{Sha: "9", Parents: []string{"A", "B"}}, | ||||
| 				{Sha: "B", Parents: []string{"D"}}, | ||||
| 				{Sha: "D", Parents: []string{"D"}}, | ||||
| 				{Sha: "A", Parents: []string{"E"}}, | ||||
| 				{Sha: "E", Parents: []string{"F"}}, | ||||
| 				{Sha: "F", Parents: []string{"D"}}, | ||||
| 				{Sha: "D", Parents: []string{"G"}}, | ||||
| 				{Hash: "1", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"3"}}, | ||||
| 				{Hash: "3", Parents: []string{"4"}}, | ||||
| 				{Hash: "4", Parents: []string{"5", "7"}}, | ||||
| 				{Hash: "7", Parents: []string{"5"}}, | ||||
| 				{Hash: "5", Parents: []string{"8"}}, | ||||
| 				{Hash: "8", Parents: []string{"9"}}, | ||||
| 				{Hash: "9", Parents: []string{"A", "B"}}, | ||||
| 				{Hash: "B", Parents: []string{"D"}}, | ||||
| 				{Hash: "D", Parents: []string{"D"}}, | ||||
| 				{Hash: "A", Parents: []string{"E"}}, | ||||
| 				{Hash: "E", Parents: []string{"F"}}, | ||||
| 				{Hash: "F", Parents: []string{"D"}}, | ||||
| 				{Hash: "D", Parents: []string{"G"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ◯ | ||||
| @@ -58,12 +58,12 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "with a path that has room to move to the left", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Sha: "4", Parents: []string{"3", "5"}}, | ||||
| 				{Sha: "3", Parents: []string{"5"}}, | ||||
| 				{Sha: "5", Parents: []string{"6"}}, | ||||
| 				{Sha: "6", Parents: []string{"7"}}, | ||||
| 				{Hash: "1", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Hash: "4", Parents: []string{"3", "5"}}, | ||||
| 				{Hash: "3", Parents: []string{"5"}}, | ||||
| 				{Hash: "5", Parents: []string{"6"}}, | ||||
| 				{Hash: "6", Parents: []string{"7"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ◯ | ||||
| @@ -76,13 +76,13 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "with a new commit", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Sha: "4", Parents: []string{"3", "5"}}, | ||||
| 				{Sha: "Z", Parents: []string{"Z"}}, | ||||
| 				{Sha: "3", Parents: []string{"5"}}, | ||||
| 				{Sha: "5", Parents: []string{"6"}}, | ||||
| 				{Sha: "6", Parents: []string{"7"}}, | ||||
| 				{Hash: "1", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Hash: "4", Parents: []string{"3", "5"}}, | ||||
| 				{Hash: "Z", Parents: []string{"Z"}}, | ||||
| 				{Hash: "3", Parents: []string{"5"}}, | ||||
| 				{Hash: "5", Parents: []string{"6"}}, | ||||
| 				{Hash: "6", Parents: []string{"7"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ◯ | ||||
| @@ -96,12 +96,12 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "with a path that has room to move to the left and continues", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Sha: "3", Parents: []string{"5", "4"}}, | ||||
| 				{Sha: "5", Parents: []string{"7", "8"}}, | ||||
| 				{Sha: "4", Parents: []string{"7"}}, | ||||
| 				{Sha: "7", Parents: []string{"11"}}, | ||||
| 				{Hash: "1", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Hash: "3", Parents: []string{"5", "4"}}, | ||||
| 				{Hash: "5", Parents: []string{"7", "8"}}, | ||||
| 				{Hash: "4", Parents: []string{"7"}}, | ||||
| 				{Hash: "7", Parents: []string{"11"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ◯ | ||||
| @@ -114,13 +114,13 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "with a path that has room to move to the left and continues", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Sha: "3", Parents: []string{"5", "4"}}, | ||||
| 				{Sha: "5", Parents: []string{"7", "8"}}, | ||||
| 				{Sha: "7", Parents: []string{"4", "A"}}, | ||||
| 				{Sha: "4", Parents: []string{"B"}}, | ||||
| 				{Sha: "B", Parents: []string{"C"}}, | ||||
| 				{Hash: "1", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Hash: "3", Parents: []string{"5", "4"}}, | ||||
| 				{Hash: "5", Parents: []string{"7", "8"}}, | ||||
| 				{Hash: "7", Parents: []string{"4", "A"}}, | ||||
| 				{Hash: "4", Parents: []string{"B"}}, | ||||
| 				{Hash: "B", Parents: []string{"C"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ◯ | ||||
| @@ -134,11 +134,11 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "with a path that has room to move to the left and continues", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2", "3"}}, | ||||
| 				{Sha: "3", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"4", "5"}}, | ||||
| 				{Sha: "4", Parents: []string{"6", "7"}}, | ||||
| 				{Sha: "6", Parents: []string{"8"}}, | ||||
| 				{Hash: "1", Parents: []string{"2", "3"}}, | ||||
| 				{Hash: "3", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"4", "5"}}, | ||||
| 				{Hash: "4", Parents: []string{"6", "7"}}, | ||||
| 				{Hash: "6", Parents: []string{"8"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ⏣─╮ | ||||
| @@ -150,11 +150,11 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "new merge path fills gap before continuing path on right", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2", "3", "4", "5"}}, | ||||
| 				{Sha: "4", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"A"}}, | ||||
| 				{Sha: "A", Parents: []string{"6", "B"}}, | ||||
| 				{Sha: "B", Parents: []string{"C"}}, | ||||
| 				{Hash: "1", Parents: []string{"2", "3", "4", "5"}}, | ||||
| 				{Hash: "4", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"A"}}, | ||||
| 				{Hash: "A", Parents: []string{"6", "B"}}, | ||||
| 				{Hash: "B", Parents: []string{"C"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ⏣─┬─┬─╮ | ||||
| @@ -166,14 +166,14 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "with a path that has room to move to the left and continues", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Sha: "3", Parents: []string{"5", "4"}}, | ||||
| 				{Sha: "5", Parents: []string{"7", "8"}}, | ||||
| 				{Sha: "7", Parents: []string{"4", "A"}}, | ||||
| 				{Sha: "4", Parents: []string{"B"}}, | ||||
| 				{Sha: "B", Parents: []string{"C"}}, | ||||
| 				{Sha: "C", Parents: []string{"D"}}, | ||||
| 				{Hash: "1", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Hash: "3", Parents: []string{"5", "4"}}, | ||||
| 				{Hash: "5", Parents: []string{"7", "8"}}, | ||||
| 				{Hash: "7", Parents: []string{"4", "A"}}, | ||||
| 				{Hash: "4", Parents: []string{"B"}}, | ||||
| 				{Hash: "B", Parents: []string{"C"}}, | ||||
| 				{Hash: "C", Parents: []string{"D"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ◯ | ||||
| @@ -188,16 +188,16 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "with a path that has room to move to the left and continues", | ||||
| 			commits: []*models.Commit{ | ||||
| 				{Sha: "1", Parents: []string{"2"}}, | ||||
| 				{Sha: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Sha: "3", Parents: []string{"5", "4"}}, | ||||
| 				{Sha: "5", Parents: []string{"7", "G"}}, | ||||
| 				{Sha: "7", Parents: []string{"8", "A"}}, | ||||
| 				{Sha: "8", Parents: []string{"4", "E"}}, | ||||
| 				{Sha: "4", Parents: []string{"B"}}, | ||||
| 				{Sha: "B", Parents: []string{"C"}}, | ||||
| 				{Sha: "C", Parents: []string{"D"}}, | ||||
| 				{Sha: "D", Parents: []string{"F"}}, | ||||
| 				{Hash: "1", Parents: []string{"2"}}, | ||||
| 				{Hash: "2", Parents: []string{"3", "4"}}, | ||||
| 				{Hash: "3", Parents: []string{"5", "4"}}, | ||||
| 				{Hash: "5", Parents: []string{"7", "G"}}, | ||||
| 				{Hash: "7", Parents: []string{"8", "A"}}, | ||||
| 				{Hash: "8", Parents: []string{"4", "E"}}, | ||||
| 				{Hash: "4", Parents: []string{"B"}}, | ||||
| 				{Hash: "B", Parents: []string{"C"}}, | ||||
| 				{Hash: "C", Parents: []string{"D"}}, | ||||
| 				{Hash: "D", Parents: []string{"F"}}, | ||||
| 			}, | ||||
| 			expectedOutput: ` | ||||
| 			1 ◯ | ||||
| @@ -231,7 +231,7 @@ func TestRenderCommitGraph(t *testing.T) { | ||||
|  | ||||
| 			output := "" | ||||
| 			for i, line := range lines { | ||||
| 				description := test.commits[i].Sha | ||||
| 				description := test.commits[i].Hash | ||||
| 				output += strings.TrimSpace(description+" "+utils.Decolorise(line)) + "\n" | ||||
| 			} | ||||
| 			t.Log("\nactual: \n" + output) | ||||
| @@ -263,32 +263,32 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "single cell", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a", toSha: "b", kind: TERMINATES, style: cyan}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "b", toSha: "c", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a", toHash: "b", kind: TERMINATES, style: cyan}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "b", toHash: "c", kind: STARTS, style: green}, | ||||
| 			}, | ||||
| 			prevCommit:     &models.Commit{Sha: "a"}, | ||||
| 			prevCommit:     &models.Commit{Hash: "a"}, | ||||
| 			expectedStr:    "◯", | ||||
| 			expectedStyles: []style.TextStyle{green}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "single cell, selected", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a", toSha: "selected", kind: TERMINATES, style: cyan}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "selected", toSha: "c", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a", toHash: "selected", kind: TERMINATES, style: cyan}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "selected", toHash: "c", kind: STARTS, style: green}, | ||||
| 			}, | ||||
| 			prevCommit:     &models.Commit{Sha: "a"}, | ||||
| 			prevCommit:     &models.Commit{Hash: "a"}, | ||||
| 			expectedStr:    "◯", | ||||
| 			expectedStyles: []style.TextStyle{highlightStyle}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "terminating hook and starting hook, selected", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a", toSha: "selected", kind: TERMINATES, style: cyan}, | ||||
| 				{fromPos: 1, toPos: 0, fromSha: "c", toSha: "selected", kind: TERMINATES, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "selected", toSha: "d", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 1, fromSha: "selected", toSha: "e", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a", toHash: "selected", kind: TERMINATES, style: cyan}, | ||||
| 				{fromPos: 1, toPos: 0, fromHash: "c", toHash: "selected", kind: TERMINATES, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "selected", toHash: "d", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 1, fromHash: "selected", toHash: "e", kind: STARTS, style: green}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "a"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "a"}, | ||||
| 			expectedStr: "⏣─╮", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				highlightStyle, highlightStyle, highlightStyle, | ||||
| @@ -297,12 +297,12 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "terminating hook and starting hook, prioritise the terminating one", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a", toSha: "b", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 1, toPos: 0, fromSha: "c", toSha: "b", kind: TERMINATES, style: magenta}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "b", toSha: "d", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 1, fromSha: "b", toSha: "e", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a", toHash: "b", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 1, toPos: 0, fromHash: "c", toHash: "b", kind: TERMINATES, style: magenta}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "b", toHash: "d", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 1, fromHash: "b", toHash: "e", kind: STARTS, style: green}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "a"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "a"}, | ||||
| 			expectedStr: "⏣─│", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				green, green, magenta, | ||||
| @@ -311,13 +311,13 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "starting and terminating pipe sharing some space", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a1", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "b1", toSha: "b2", kind: CONTINUES, style: magenta}, | ||||
| 				{fromPos: 3, toPos: 0, fromSha: "e1", toSha: "a2", kind: TERMINATES, style: green}, | ||||
| 				{fromPos: 0, toPos: 2, fromSha: "a2", toSha: "c3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a1", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a2", toHash: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "b1", toHash: "b2", kind: CONTINUES, style: magenta}, | ||||
| 				{fromPos: 3, toPos: 0, fromHash: "e1", toHash: "a2", kind: TERMINATES, style: green}, | ||||
| 				{fromPos: 0, toPos: 2, fromHash: "a2", toHash: "c3", kind: STARTS, style: yellow}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "a1"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "a1"}, | ||||
| 			expectedStr: "⏣─│─┬─╯", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				yellow, yellow, magenta, yellow, yellow, green, green, | ||||
| @@ -326,13 +326,13 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "starting and terminating pipe sharing some space, with selection", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a1", toSha: "selected", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "selected", toSha: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "b1", toSha: "b2", kind: CONTINUES, style: magenta}, | ||||
| 				{fromPos: 3, toPos: 0, fromSha: "e1", toSha: "selected", kind: TERMINATES, style: green}, | ||||
| 				{fromPos: 0, toPos: 2, fromSha: "selected", toSha: "c3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a1", toHash: "selected", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "selected", toHash: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "b1", toHash: "b2", kind: CONTINUES, style: magenta}, | ||||
| 				{fromPos: 3, toPos: 0, fromHash: "e1", toHash: "selected", kind: TERMINATES, style: green}, | ||||
| 				{fromPos: 0, toPos: 2, fromHash: "selected", toHash: "c3", kind: STARTS, style: yellow}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "a1"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "a1"}, | ||||
| 			expectedStr: "⏣───╮ ╯", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				highlightStyle, highlightStyle, highlightStyle, highlightStyle, highlightStyle, nothing, green, | ||||
| @@ -341,12 +341,12 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "many terminating pipes", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a1", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 0, fromSha: "b1", toSha: "a2", kind: TERMINATES, style: magenta}, | ||||
| 				{fromPos: 2, toPos: 0, fromSha: "c1", toSha: "a2", kind: TERMINATES, style: green}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a1", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a2", toHash: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 0, fromHash: "b1", toHash: "a2", kind: TERMINATES, style: magenta}, | ||||
| 				{fromPos: 2, toPos: 0, fromHash: "c1", toHash: "a2", kind: TERMINATES, style: green}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "a1"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "a1"}, | ||||
| 			expectedStr: "◯─┴─╯", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				yellow, magenta, magenta, green, green, | ||||
| @@ -355,13 +355,13 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "starting pipe passing through", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a1", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 3, fromSha: "a2", toSha: "d3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "b1", toSha: "b3", kind: CONTINUES, style: magenta}, | ||||
| 				{fromPos: 2, toPos: 2, fromSha: "c1", toSha: "c3", kind: CONTINUES, style: green}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a1", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a2", toHash: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 3, fromHash: "a2", toHash: "d3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "b1", toHash: "b3", kind: CONTINUES, style: magenta}, | ||||
| 				{fromPos: 2, toPos: 2, fromHash: "c1", toHash: "c3", kind: CONTINUES, style: green}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "a1"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "a1"}, | ||||
| 			expectedStr: "⏣─│─│─╮", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				yellow, yellow, magenta, yellow, green, yellow, yellow, | ||||
| @@ -370,13 +370,13 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "starting and terminating path crossing continuing path", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a1", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 1, fromSha: "a2", toSha: "b3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "b1", toSha: "a2", kind: CONTINUES, style: green}, | ||||
| 				{fromPos: 2, toPos: 0, fromSha: "c1", toSha: "a2", kind: TERMINATES, style: magenta}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a1", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a2", toHash: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 1, fromHash: "a2", toHash: "b3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "b1", toHash: "a2", kind: CONTINUES, style: green}, | ||||
| 				{fromPos: 2, toPos: 0, fromHash: "c1", toHash: "a2", kind: TERMINATES, style: magenta}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "a1"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "a1"}, | ||||
| 			expectedStr: "⏣─│─╯", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				yellow, yellow, green, magenta, magenta, | ||||
| @@ -385,13 +385,13 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "another clash of starting and terminating paths", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a1", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 1, fromSha: "a2", toSha: "b3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 2, toPos: 2, fromSha: "c1", toSha: "c3", kind: CONTINUES, style: green}, | ||||
| 				{fromPos: 3, toPos: 0, fromSha: "d1", toSha: "a2", kind: TERMINATES, style: magenta}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a1", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a2", toHash: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 1, fromHash: "a2", toHash: "b3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 2, toPos: 2, fromHash: "c1", toHash: "c3", kind: CONTINUES, style: green}, | ||||
| 				{fromPos: 3, toPos: 0, fromHash: "d1", toHash: "a2", kind: TERMINATES, style: magenta}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "a1"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "a1"}, | ||||
| 			expectedStr: "⏣─┬─│─╯", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				yellow, yellow, yellow, magenta, green, magenta, magenta, | ||||
| @@ -400,10 +400,10 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "commit whose previous commit is selected", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "selected", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "selected", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a2", toHash: "a3", kind: STARTS, style: yellow}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "selected"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "selected"}, | ||||
| 			expectedStr: "◯", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				yellow, | ||||
| @@ -412,10 +412,10 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "commit whose previous commit is selected and is a merge commit", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "selected", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "selected", toSha: "b3", kind: CONTINUES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "selected", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "selected", toHash: "b3", kind: CONTINUES, style: red}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "selected"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "selected"}, | ||||
| 			expectedStr: "◯ │", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				highlightStyle, nothing, highlightStyle, | ||||
| @@ -424,11 +424,11 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "commit whose previous commit is selected and is a merge commit, with continuing pipe inbetween", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "selected", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "z1", toSha: "z3", kind: CONTINUES, style: green}, | ||||
| 				{fromPos: 2, toPos: 2, fromSha: "selected", toSha: "b3", kind: CONTINUES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "selected", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "z1", toHash: "z3", kind: CONTINUES, style: green}, | ||||
| 				{fromPos: 2, toPos: 2, fromHash: "selected", toHash: "b3", kind: CONTINUES, style: red}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "selected"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "selected"}, | ||||
| 			expectedStr: "◯ │ │", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				highlightStyle, nothing, green, nothing, highlightStyle, | ||||
| @@ -437,12 +437,12 @@ func TestRenderPipeSet(t *testing.T) { | ||||
| 		{ | ||||
| 			name: "when previous commit is selected, not a merge commit, and spawns a continuing pipe", | ||||
| 			pipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a1", toSha: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a2", toSha: "a3", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 1, fromSha: "a2", toSha: "b3", kind: STARTS, style: green}, | ||||
| 				{fromPos: 1, toPos: 0, fromSha: "selected", toSha: "a2", kind: TERMINATES, style: yellow}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a1", toHash: "a2", kind: TERMINATES, style: red}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a2", toHash: "a3", kind: STARTS, style: green}, | ||||
| 				{fromPos: 0, toPos: 1, fromHash: "a2", toHash: "b3", kind: STARTS, style: green}, | ||||
| 				{fromPos: 1, toPos: 0, fromHash: "selected", toHash: "a2", kind: TERMINATES, style: yellow}, | ||||
| 			}, | ||||
| 			prevCommit:  &models.Commit{Sha: "selected"}, | ||||
| 			prevCommit:  &models.Commit{Hash: "selected"}, | ||||
| 			expectedStr: "⏣─╯", | ||||
| 			expectedStyles: []style.TextStyle{ | ||||
| 				highlightStyle, highlightStyle, highlightStyle, | ||||
| @@ -483,43 +483,43 @@ func TestGetNextPipes(t *testing.T) { | ||||
| 	}{ | ||||
| 		{ | ||||
| 			prevPipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a", toSha: "b", kind: STARTS, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a", toHash: "b", kind: STARTS, style: style.FgDefault}, | ||||
| 			}, | ||||
| 			commit: &models.Commit{ | ||||
| 				Sha:     "b", | ||||
| 				Hash:    "b", | ||||
| 				Parents: []string{"c"}, | ||||
| 			}, | ||||
| 			expected: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a", toSha: "b", kind: TERMINATES, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "b", toSha: "c", kind: STARTS, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a", toHash: "b", kind: TERMINATES, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "b", toHash: "c", kind: STARTS, style: style.FgDefault}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			prevPipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a", toSha: "b", kind: TERMINATES, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "b", toSha: "c", kind: STARTS, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 1, fromSha: "b", toSha: "d", kind: STARTS, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a", toHash: "b", kind: TERMINATES, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "b", toHash: "c", kind: STARTS, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 1, fromHash: "b", toHash: "d", kind: STARTS, style: style.FgDefault}, | ||||
| 			}, | ||||
| 			commit: &models.Commit{ | ||||
| 				Sha:     "d", | ||||
| 				Hash:    "d", | ||||
| 				Parents: []string{"e"}, | ||||
| 			}, | ||||
| 			expected: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "b", toSha: "c", kind: CONTINUES, style: style.FgDefault}, | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "b", toSha: "d", kind: TERMINATES, style: style.FgDefault}, | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "d", toSha: "e", kind: STARTS, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "b", toHash: "c", kind: CONTINUES, style: style.FgDefault}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "b", toHash: "d", kind: TERMINATES, style: style.FgDefault}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "d", toHash: "e", kind: STARTS, style: style.FgDefault}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			prevPipes: []*Pipe{ | ||||
| 				{fromPos: 0, toPos: 0, fromSha: "a", toSha: "root", kind: TERMINATES, style: style.FgDefault}, | ||||
| 				{fromPos: 0, toPos: 0, fromHash: "a", toHash: "root", kind: TERMINATES, style: style.FgDefault}, | ||||
| 			}, | ||||
| 			commit: &models.Commit{ | ||||
| 				Sha:     "root", | ||||
| 				Hash:    "root", | ||||
| 				Parents: []string{}, | ||||
| 			}, | ||||
| 			expected: []*Pipe{ | ||||
| 				{fromPos: 1, toPos: 1, fromSha: "root", toSha: models.EmptyTreeCommitHash, kind: STARTS, style: style.FgDefault}, | ||||
| 				{fromPos: 1, toPos: 1, fromHash: "root", toHash: models.EmptyTreeCommitHash, kind: STARTS, style: style.FgDefault}, | ||||
| 			}, | ||||
| 		}, | ||||
| 	} | ||||
| @@ -557,7 +557,7 @@ func BenchmarkRenderCommitGraph(b *testing.B) { | ||||
|  | ||||
| func generateCommits(count int) []*models.Commit { | ||||
| 	rnd := rand.New(rand.NewSource(1234)) | ||||
| 	pool := []*models.Commit{{Sha: "a", AuthorName: "A"}} | ||||
| 	pool := []*models.Commit{{Hash: "a", AuthorName: "A"}} | ||||
| 	commits := make([]*models.Commit, 0, count) | ||||
| 	authorPool := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} | ||||
| 	for len(commits) < count { | ||||
| @@ -574,12 +574,12 @@ func generateCommits(count int) []*models.Commit { | ||||
| 				newParent = pool[j] | ||||
| 			} else { | ||||
| 				newParent = &models.Commit{ | ||||
| 					Sha:        fmt.Sprintf("%s%d", currentCommit.Sha, j), | ||||
| 					Hash:       fmt.Sprintf("%s%d", currentCommit.Hash, j), | ||||
| 					AuthorName: authorPool[rnd.Intn(len(authorPool))], | ||||
| 				} | ||||
| 				pool = append(pool, newParent) | ||||
| 			} | ||||
| 			currentCommit.Parents = append(currentCommit.Parents, newParent.Sha) | ||||
| 			currentCommit.Parents = append(currentCommit.Parents, newParent.Hash) | ||||
| 		} | ||||
|  | ||||
| 		commits = append(commits, currentCommit) | ||||
|   | ||||
| @@ -21,8 +21,8 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription | ||||
| 	} | ||||
|  | ||||
| 	return lo.Map(commits, func(commit *models.Commit, _ int) []string { | ||||
| 		diffed := commit.Sha == diffName | ||||
| 		cherryPicked := cherryPickedCommitHashSet.Includes(commit.Sha) | ||||
| 		diffed := commit.Hash == diffName | ||||
| 		cherryPicked := cherryPickedCommitHashSet.Includes(commit.Hash) | ||||
| 		return displayFunc(commit, | ||||
| 			reflogCommitDisplayAttributes{ | ||||
| 				cherryPicked:    cherryPicked, | ||||
|   | ||||
| @@ -11,7 +11,7 @@ import ( | ||||
| ) | ||||
|  | ||||
| type Todo struct { | ||||
| 	Sha    string // for todos that have one, e.g. pick, drop, fixup, etc. | ||||
| 	Hash   string // for todos that have one, e.g. pick, drop, fixup, etc. | ||||
| 	Ref    string // for update-ref todos | ||||
| 	Action todo.TodoCommand | ||||
| } | ||||
| @@ -20,7 +20,7 @@ type Todo struct { | ||||
| // because sometimes the same sha appears multiple times in the file (e.g. in a pick | ||||
| // and later in a merge) | ||||
| type TodoChange struct { | ||||
| 	Sha       string | ||||
| 	Hash      string | ||||
| 	OldAction todo.TodoCommand | ||||
| 	NewAction todo.TodoCommand | ||||
| } | ||||
| @@ -38,7 +38,7 @@ func EditRebaseTodo(filePath string, changes []TodoChange, commentChar byte) err | ||||
| 		t := &todos[i] | ||||
| 		// This is a nested loop, but it's ok because the number of todos should be small | ||||
| 		for _, change := range changes { | ||||
| 			if t.Command == change.OldAction && equalShas(t.Commit, change.Sha) { | ||||
| 			if t.Command == change.OldAction && equalShas(t.Commit, change.Hash) { | ||||
| 				matchCount++ | ||||
| 				t.Command = change.NewAction | ||||
| 			} | ||||
| @@ -64,7 +64,7 @@ func findTodo(todos []todo.Todo, todoToFind Todo) (int, bool) { | ||||
| 		// pick and later in a merge). For update-ref todos we also must compare | ||||
| 		// the Ref. | ||||
| 		return t.Command == todoToFind.Action && | ||||
| 			equalShas(t.Commit, todoToFind.Sha) && | ||||
| 			equalShas(t.Commit, todoToFind.Hash) && | ||||
| 			t.Ref == todoToFind.Ref | ||||
| 	}) | ||||
| 	return idx, ok | ||||
| @@ -136,7 +136,7 @@ func deleteTodos(todos []todo.Todo, todosToDelete []Todo) ([]todo.Todo, error) { | ||||
|  | ||||
| 		if !ok { | ||||
| 			// Should never happen | ||||
| 			return []todo.Todo{}, fmt.Errorf("Todo %s not found in git-rebase-todo", todoToDelete.Sha) | ||||
| 			return []todo.Todo{}, fmt.Errorf("Todo %s not found in git-rebase-todo", todoToDelete.Hash) | ||||
| 		} | ||||
|  | ||||
| 		todos = Remove(todos, idx) | ||||
| @@ -184,7 +184,7 @@ func moveTodoUp(todos []todo.Todo, todoToMove Todo) ([]todo.Todo, error) { | ||||
|  | ||||
| 	if !ok { | ||||
| 		// Should never happen | ||||
| 		return []todo.Todo{}, fmt.Errorf("Todo %s not found in git-rebase-todo", todoToMove.Sha) | ||||
| 		return []todo.Todo{}, fmt.Errorf("Todo %s not found in git-rebase-todo", todoToMove.Hash) | ||||
| 	} | ||||
|  | ||||
| 	// The todos are ordered backwards compared to our model commits, so | ||||
|   | ||||
| @@ -25,7 +25,7 @@ func TestRebaseCommands_moveTodoDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "abcd"}, | ||||
| 			}, | ||||
| 			todoToMoveDown: Todo{Sha: "5678", Action: todo.Pick}, | ||||
| 			todoToMoveDown: Todo{Hash: "5678", Action: todo.Pick}, | ||||
| 			expectedErr:    "", | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| @@ -40,7 +40,7 @@ func TestRebaseCommands_moveTodoDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "abcd"}, | ||||
| 			}, | ||||
| 			todoToMoveDown: Todo{Sha: "abcd", Action: todo.Pick}, | ||||
| 			todoToMoveDown: Todo{Hash: "abcd", Action: todo.Pick}, | ||||
| 			expectedErr:    "", | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "1234"}, | ||||
| @@ -72,7 +72,7 @@ func TestRebaseCommands_moveTodoDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "def0"}, | ||||
| 			}, | ||||
| 			todoToMoveDown: Todo{Sha: "5678", Action: todo.Pick}, | ||||
| 			todoToMoveDown: Todo{Hash: "5678", Action: todo.Pick}, | ||||
| 			expectedErr:    "", | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "1234"}, | ||||
| @@ -91,7 +91,7 @@ func TestRebaseCommands_moveTodoDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "abcd"}, | ||||
| 			}, | ||||
| 			todoToMoveDown: Todo{Sha: "def0", Action: todo.Pick}, | ||||
| 			todoToMoveDown: Todo{Hash: "def0", Action: todo.Pick}, | ||||
| 			expectedErr:    "Todo def0 not found in git-rebase-todo", | ||||
| 			expectedTodos:  []todo.Todo{}, | ||||
| 		}, | ||||
| @@ -102,7 +102,7 @@ func TestRebaseCommands_moveTodoDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "abcd"}, | ||||
| 			}, | ||||
| 			todoToMoveDown: Todo{Sha: "1234", Action: todo.Pick}, | ||||
| 			todoToMoveDown: Todo{Hash: "1234", Action: todo.Pick}, | ||||
| 			expectedErr:    "Destination position for moving todo is out of range", | ||||
| 			expectedTodos:  []todo.Todo{}, | ||||
| 		}, | ||||
| @@ -114,7 +114,7 @@ func TestRebaseCommands_moveTodoDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "1234"}, | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 			}, | ||||
| 			todoToMoveDown: Todo{Sha: "1234", Action: todo.Pick}, | ||||
| 			todoToMoveDown: Todo{Hash: "1234", Action: todo.Pick}, | ||||
| 			expectedErr:    "Destination position for moving todo is out of range", | ||||
| 			expectedTodos:  []todo.Todo{}, | ||||
| 		}, | ||||
| @@ -151,7 +151,7 @@ func TestRebaseCommands_moveTodoUp(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "abcd"}, | ||||
| 			}, | ||||
| 			todoToMoveUp: Todo{Sha: "5678", Action: todo.Pick}, | ||||
| 			todoToMoveUp: Todo{Hash: "5678", Action: todo.Pick}, | ||||
| 			expectedErr:  "", | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "1234"}, | ||||
| @@ -166,7 +166,7 @@ func TestRebaseCommands_moveTodoUp(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "abcd"}, | ||||
| 			}, | ||||
| 			todoToMoveUp: Todo{Sha: "1234", Action: todo.Pick}, | ||||
| 			todoToMoveUp: Todo{Hash: "1234", Action: todo.Pick}, | ||||
| 			expectedErr:  "", | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| @@ -198,7 +198,7 @@ func TestRebaseCommands_moveTodoUp(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "def0"}, | ||||
| 			}, | ||||
| 			todoToMoveUp: Todo{Sha: "abcd", Action: todo.Pick}, | ||||
| 			todoToMoveUp: Todo{Hash: "abcd", Action: todo.Pick}, | ||||
| 			expectedErr:  "", | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "1234"}, | ||||
| @@ -217,7 +217,7 @@ func TestRebaseCommands_moveTodoUp(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "abcd"}, | ||||
| 			}, | ||||
| 			todoToMoveUp:  Todo{Sha: "def0", Action: todo.Pick}, | ||||
| 			todoToMoveUp:  Todo{Hash: "def0", Action: todo.Pick}, | ||||
| 			expectedErr:   "Todo def0 not found in git-rebase-todo", | ||||
| 			expectedTodos: []todo.Todo{}, | ||||
| 		}, | ||||
| @@ -228,7 +228,7 @@ func TestRebaseCommands_moveTodoUp(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 				{Command: todo.Pick, Commit: "abcd"}, | ||||
| 			}, | ||||
| 			todoToMoveUp:  Todo{Sha: "abcd", Action: todo.Pick}, | ||||
| 			todoToMoveUp:  Todo{Hash: "abcd", Action: todo.Pick}, | ||||
| 			expectedErr:   "Destination position for moving todo is out of range", | ||||
| 			expectedTodos: []todo.Todo{}, | ||||
| 		}, | ||||
| @@ -240,7 +240,7 @@ func TestRebaseCommands_moveTodoUp(t *testing.T) { | ||||
| 				{Command: todo.Label, Label: "myLabel"}, | ||||
| 				{Command: todo.Reset, Label: "otherlabel"}, | ||||
| 			}, | ||||
| 			todoToMoveUp:  Todo{Sha: "5678", Action: todo.Pick}, | ||||
| 			todoToMoveUp:  Todo{Hash: "5678", Action: todo.Pick}, | ||||
| 			expectedErr:   "Destination position for moving todo is out of range", | ||||
| 			expectedTodos: []todo.Todo{}, | ||||
| 		}, | ||||
| @@ -264,8 +264,8 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { | ||||
| 	scenarios := []struct { | ||||
| 		name          string | ||||
| 		todos         []todo.Todo | ||||
| 		originalSha   string | ||||
| 		fixupSha      string | ||||
| 		originalHash  string | ||||
| 		fixupHash     string | ||||
| 		expectedTodos []todo.Todo | ||||
| 		expectedErr   error | ||||
| 	}{ | ||||
| @@ -275,8 +275,8 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "original"}, | ||||
| 				{Command: todo.Pick, Commit: "fixup"}, | ||||
| 			}, | ||||
| 			originalSha: "original", | ||||
| 			fixupSha:    "fixup", | ||||
| 			originalHash: "original", | ||||
| 			fixupHash:    "fixup", | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "original"}, | ||||
| 				{Command: todo.Fixup, Commit: "fixup"}, | ||||
| @@ -291,8 +291,8 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "other"}, | ||||
| 				{Command: todo.Pick, Commit: "fixup"}, | ||||
| 			}, | ||||
| 			originalSha: "original", | ||||
| 			fixupSha:    "fixup", | ||||
| 			originalHash: "original", | ||||
| 			fixupHash:    "fixup", | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "original"}, | ||||
| 				{Command: todo.Fixup, Commit: "fixup"}, | ||||
| @@ -307,8 +307,8 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "original"}, | ||||
| 				{Command: todo.Pick, Commit: "fixup"}, | ||||
| 			}, | ||||
| 			originalSha:   "original", | ||||
| 			fixupSha:      "fixup", | ||||
| 			originalHash:  "original", | ||||
| 			fixupHash:     "fixup", | ||||
| 			expectedTodos: nil, | ||||
| 			expectedErr:   errors.New("Expected exactly one original SHA, found 2"), | ||||
| 		}, | ||||
| @@ -319,8 +319,8 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "fixup"}, | ||||
| 				{Command: todo.Pick, Commit: "fixup"}, | ||||
| 			}, | ||||
| 			originalSha:   "original", | ||||
| 			fixupSha:      "fixup", | ||||
| 			originalHash:  "original", | ||||
| 			fixupHash:     "fixup", | ||||
| 			expectedTodos: nil, | ||||
| 			expectedErr:   errors.New("Expected exactly one fixup SHA, found 2"), | ||||
| 		}, | ||||
| @@ -329,8 +329,8 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { | ||||
| 			todos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "original"}, | ||||
| 			}, | ||||
| 			originalSha:   "original", | ||||
| 			fixupSha:      "fixup", | ||||
| 			originalHash:  "original", | ||||
| 			fixupHash:     "fixup", | ||||
| 			expectedTodos: nil, | ||||
| 			expectedErr:   errors.New("Expected exactly one fixup SHA, found 0"), | ||||
| 		}, | ||||
| @@ -339,8 +339,8 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { | ||||
| 			todos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "fixup"}, | ||||
| 			}, | ||||
| 			originalSha:   "original", | ||||
| 			fixupSha:      "fixup", | ||||
| 			originalHash:  "original", | ||||
| 			fixupHash:     "fixup", | ||||
| 			expectedTodos: nil, | ||||
| 			expectedErr:   errors.New("Expected exactly one original SHA, found 0"), | ||||
| 		}, | ||||
| @@ -348,7 +348,7 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) { | ||||
|  | ||||
| 	for _, scenario := range scenarios { | ||||
| 		t.Run(scenario.name, func(t *testing.T) { | ||||
| 			actualTodos, actualErr := moveFixupCommitDown(scenario.todos, scenario.originalSha, scenario.fixupSha) | ||||
| 			actualTodos, actualErr := moveFixupCommitDown(scenario.todos, scenario.originalHash, scenario.fixupHash) | ||||
|  | ||||
| 			if scenario.expectedErr == nil { | ||||
| 				assert.NoError(t, actualErr) | ||||
| @@ -379,7 +379,7 @@ func TestRebaseCommands_deleteTodos(t *testing.T) { | ||||
| 			}, | ||||
| 			todosToDelete: []Todo{ | ||||
| 				{Ref: "refs/heads/some_branch", Action: todo.UpdateRef}, | ||||
| 				{Sha: "abcd", Action: todo.Pick}, | ||||
| 				{Hash: "abcd", Action: todo.Pick}, | ||||
| 			}, | ||||
| 			expectedTodos: []todo.Todo{ | ||||
| 				{Command: todo.Pick, Commit: "1234"}, | ||||
| @@ -394,7 +394,7 @@ func TestRebaseCommands_deleteTodos(t *testing.T) { | ||||
| 				{Command: todo.Pick, Commit: "5678"}, | ||||
| 			}, | ||||
| 			todosToDelete: []Todo{ | ||||
| 				{Sha: "abcd", Action: todo.Pick}, | ||||
| 				{Hash: "abcd", Action: todo.Pick}, | ||||
| 			}, | ||||
| 			expectedTodos: []todo.Todo{}, | ||||
| 			expectedErr:   errors.New("Todo abcd not found in git-rebase-todo"), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user