mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
rename sha to hash 8, update some log and comment
This commit is contained in:
@ -45,7 +45,7 @@ func (self *ReflogCommitLoader) GetReflogCommits(lastReflogCommit *models.Commit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// note that the unix timestamp here is the timestamp of the COMMIT, not the reflog entry itself,
|
// note that the unix timestamp here is the timestamp of the COMMIT, not the reflog entry itself,
|
||||||
// so two consecutive reflog entries may have both the same SHA and therefore same timestamp.
|
// so two consecutive reflog entries may have both the same hash and therefore same timestamp.
|
||||||
// We use the reflog message to disambiguate, and fingers crossed that we never see the same of those
|
// We use the reflog message to disambiguate, and fingers crossed that we never see the same of those
|
||||||
// twice in a row. Reason being that it would mean we'd be erroneously exiting early.
|
// twice in a row. Reason being that it would mean we'd be erroneously exiting early.
|
||||||
if lastReflogCommit != nil && self.sameReflogCommit(commit, lastReflogCommit) {
|
if lastReflogCommit != nil && self.sameReflogCommit(commit, lastReflogCommit) {
|
||||||
|
@ -54,7 +54,7 @@ type Commit struct {
|
|||||||
UnixTimestamp int64
|
UnixTimestamp int64
|
||||||
Divergence Divergence // set to DivergenceNone unless we are showing the divergence view
|
Divergence Divergence // set to DivergenceNone unless we are showing the divergence view
|
||||||
|
|
||||||
// SHAs of parent commits (will be multiple if it's a merge commit)
|
// Hashes of parent commits (will be multiple if it's a merge commit)
|
||||||
Parents []string
|
Parents []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ func (self *ReposHelper) getCurrentBranch(path string) string {
|
|||||||
// is a branch
|
// is a branch
|
||||||
branchDisplay = strings.TrimPrefix(content, refsPrefix)
|
branchDisplay = strings.TrimPrefix(content, refsPrefix)
|
||||||
} else {
|
} else {
|
||||||
// detached HEAD state, displaying short SHA
|
// detached HEAD state, displaying short hash
|
||||||
branchDisplay = utils.ShortHash(content)
|
branchDisplay = utils.ShortHash(content)
|
||||||
}
|
}
|
||||||
return branchDisplay, nil
|
return branchDisplay, nil
|
||||||
|
@ -245,7 +245,7 @@ type IListPanelState interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ListItem interface {
|
type ListItem interface {
|
||||||
// ID is a SHA when the item is a commit, a filename when the item is a file, 'stash@{4}' when it's a stash entry, 'my_branch' when it's a branch
|
// ID is a hash when the item is a commit, a filename when the item is a file, 'stash@{4}' when it's a stash entry, 'my_branch' when it's a branch
|
||||||
ID() string
|
ID() string
|
||||||
|
|
||||||
// Description is something we would show in a message e.g. '123as14: push blah' for a commit
|
// Description is something we would show in a message e.g. '123as14: push blah' for a commit
|
||||||
|
@ -244,12 +244,12 @@ func moveFixupCommitDown(todos []todo.Todo, originalSha string, fixupSha string)
|
|||||||
|
|
||||||
originalShaCount := lo.CountBy(todos, isOriginal)
|
originalShaCount := lo.CountBy(todos, isOriginal)
|
||||||
if originalShaCount != 1 {
|
if originalShaCount != 1 {
|
||||||
return nil, fmt.Errorf("Expected exactly one original SHA, found %d", originalShaCount)
|
return nil, fmt.Errorf("Expected exactly one original hash, found %d", originalShaCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
fixupShaCount := lo.CountBy(todos, isFixup)
|
fixupShaCount := lo.CountBy(todos, isFixup)
|
||||||
if fixupShaCount != 1 {
|
if fixupShaCount != 1 {
|
||||||
return nil, fmt.Errorf("Expected exactly one fixup SHA, found %d", fixupShaCount)
|
return nil, fmt.Errorf("Expected exactly one fixup hash, found %d", fixupShaCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, fixupIndex, _ := lo.FindIndexOf(todos, isFixup)
|
_, fixupIndex, _ := lo.FindIndexOf(todos, isFixup)
|
||||||
|
@ -301,7 +301,7 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) {
|
|||||||
expectedErr: nil,
|
expectedErr: nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "More original SHAs than expected",
|
name: "More original hashes than expected",
|
||||||
todos: []todo.Todo{
|
todos: []todo.Todo{
|
||||||
{Command: todo.Pick, Commit: "original"},
|
{Command: todo.Pick, Commit: "original"},
|
||||||
{Command: todo.Pick, Commit: "original"},
|
{Command: todo.Pick, Commit: "original"},
|
||||||
@ -310,10 +310,10 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) {
|
|||||||
originalHash: "original",
|
originalHash: "original",
|
||||||
fixupHash: "fixup",
|
fixupHash: "fixup",
|
||||||
expectedTodos: nil,
|
expectedTodos: nil,
|
||||||
expectedErr: errors.New("Expected exactly one original SHA, found 2"),
|
expectedErr: errors.New("Expected exactly one original hash, found 2"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "More fixup SHAs than expected",
|
name: "More fixup hashes than expected",
|
||||||
todos: []todo.Todo{
|
todos: []todo.Todo{
|
||||||
{Command: todo.Pick, Commit: "original"},
|
{Command: todo.Pick, Commit: "original"},
|
||||||
{Command: todo.Pick, Commit: "fixup"},
|
{Command: todo.Pick, Commit: "fixup"},
|
||||||
@ -322,27 +322,27 @@ func TestRebaseCommands_moveFixupCommitDown(t *testing.T) {
|
|||||||
originalHash: "original",
|
originalHash: "original",
|
||||||
fixupHash: "fixup",
|
fixupHash: "fixup",
|
||||||
expectedTodos: nil,
|
expectedTodos: nil,
|
||||||
expectedErr: errors.New("Expected exactly one fixup SHA, found 2"),
|
expectedErr: errors.New("Expected exactly one fixup hash, found 2"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "No fixup SHAs found",
|
name: "No fixup hashes found",
|
||||||
todos: []todo.Todo{
|
todos: []todo.Todo{
|
||||||
{Command: todo.Pick, Commit: "original"},
|
{Command: todo.Pick, Commit: "original"},
|
||||||
},
|
},
|
||||||
originalHash: "original",
|
originalHash: "original",
|
||||||
fixupHash: "fixup",
|
fixupHash: "fixup",
|
||||||
expectedTodos: nil,
|
expectedTodos: nil,
|
||||||
expectedErr: errors.New("Expected exactly one fixup SHA, found 0"),
|
expectedErr: errors.New("Expected exactly one fixup hash, found 0"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "No original SHAs found",
|
name: "No original hashes found",
|
||||||
todos: []todo.Todo{
|
todos: []todo.Todo{
|
||||||
{Command: todo.Pick, Commit: "fixup"},
|
{Command: todo.Pick, Commit: "fixup"},
|
||||||
},
|
},
|
||||||
originalHash: "original",
|
originalHash: "original",
|
||||||
fixupHash: "fixup",
|
fixupHash: "fixup",
|
||||||
expectedTodos: nil,
|
expectedTodos: nil,
|
||||||
expectedErr: errors.New("Expected exactly one original SHA, found 0"),
|
expectedErr: errors.New("Expected exactly one original hash, found 0"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user