mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-05 21:46:49 -04:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ddfec40f2b | ||
|
|
d5e0630967 | ||
|
|
37c671b4c0 |
@@ -316,7 +316,7 @@ func (self *CommitLoader) getHydratedRebasingCommits(rebaseMode enums.RebaseMode
|
||||
// getRebasingCommits obtains the commits that we're in the process of rebasing
|
||||
func (self *CommitLoader) getRebasingCommits(rebaseMode enums.RebaseMode) ([]*models.Commit, error) {
|
||||
switch rebaseMode {
|
||||
case enums.REBASE_MODE_MERGING:
|
||||
case enums.REBASE_MODE_NORMAL:
|
||||
return self.getNormalRebasingCommits()
|
||||
case enums.REBASE_MODE_INTERACTIVE:
|
||||
return self.getInteractiveRebasingCommits()
|
||||
|
||||
@@ -68,8 +68,8 @@ func GetCommitListDisplayStrings(
|
||||
return nil
|
||||
}
|
||||
|
||||
// this is where my non-TODO commits begin
|
||||
rebaseOffset := utils.Min(indexOfFirstNonTODOCommit(commits), endIdx)
|
||||
// this is where my "normal" commits begin (the non-rebasing ones)
|
||||
rebaseOffset := utils.Min(indexOfFirstNonRebasingCommit(commits), endIdx)
|
||||
|
||||
filteredCommits := commits[startIdx:endIdx]
|
||||
|
||||
@@ -187,9 +187,9 @@ func getbisectBounds(commits []*models.Commit, bisectInfo *git_commands.BisectIn
|
||||
}
|
||||
|
||||
// precondition: slice is not empty
|
||||
func indexOfFirstNonTODOCommit(commits []*models.Commit) int {
|
||||
func indexOfFirstNonRebasingCommit(commits []*models.Commit) int {
|
||||
for i, commit := range commits {
|
||||
if !commit.IsTODO() {
|
||||
if commit.Status != models.StatusRebasing {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,8 +216,8 @@ 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: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
|
||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||
@@ -240,8 +240,8 @@ 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: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
|
||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||
@@ -263,8 +263,8 @@ 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: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
|
||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||
@@ -284,8 +284,8 @@ 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: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
|
||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}},
|
||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||
@@ -325,10 +325,10 @@ 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: "commit1", Sha: "sha1", Parents: []string{"sha2", "sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit4", Sha: "sha4", Parents: []string{"sha5"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit5", Sha: "sha5", Parents: []string{"sha7"}},
|
||||
},
|
||||
startIdx: 0,
|
||||
@@ -346,7 +346,7 @@ 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: "commit1", Sha: "sha1", Parents: []string{"sha2"}, Action: todo.Pick, Status: models.StatusRebasing},
|
||||
{Name: "commit2", Sha: "sha2", Parents: []string{"sha3"}},
|
||||
{Name: "commit3", Sha: "sha3", Parents: []string{"sha4"}},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user