summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-02-24 12:38:49 +0100
committerStefan Haller <stefan@haller-berlin.de>2024-03-02 10:17:58 +0100
commit416a40b0e69605399bde4b03a0ed48977da1dae8 (patch)
tree822dc5c7486b556caed40dddf0a654b1f95cd51e
parent418b316fabf394e14a7c1153f514a52bee48ec39 (diff)
Don't show branch head on rebase todos if the rebase.updateRefs config is on
The additional branch head icon is more confusing than useful in this situation. The update-ref entries show very clearly where the branch heads will go when continuing the rebase; the information where the branch heads used to be before the rebase is not really needed here, and just makes the display more confusing. I'm not adding more tests here because the changes to the existing tests demonstrate the change clearly enough.
-rw-r--r--pkg/gui/presentation/commits.go8
-rw-r--r--pkg/integration/tests/interactive_rebase/dont_show_branch_heads_for_todo_items.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/quick_start_keep_selection.go2
-rw-r--r--pkg/integration/tests/interactive_rebase/quick_start_keep_selection_range.go4
-rw-r--r--pkg/integration/tests/interactive_rebase/view_files_of_todo_entries.go2
6 files changed, 13 insertions, 7 deletions
diff --git a/pkg/gui/presentation/commits.go b/pkg/gui/presentation/commits.go
index 97f7c801d..bd4057e41 100644
--- a/pkg/gui/presentation/commits.go
+++ b/pkg/gui/presentation/commits.go
@@ -145,6 +145,7 @@ func GetCommitListDisplayStrings(
common,
commit,
branchHeadsToVisualize,
+ hasRebaseUpdateRefsConfig,
cherryPickedCommitShaSet,
isMarkedBaseCommit,
willBeRebased,
@@ -296,6 +297,7 @@ func displayCommit(
common *common.Common,
commit *models.Commit,
branchHeadsToVisualize *set.Set[string],
+ hasRebaseUpdateRefsConfig bool,
cherryPickedCommitShaSet *set.Set[string],
isMarkedBaseCommit bool,
willBeRebased bool,
@@ -329,7 +331,11 @@ func displayCommit(
tagString = theme.DiffTerminalColor.SetBold().Sprint(strings.Join(commit.Tags, " ")) + " "
}
- if branchHeadsToVisualize.Includes(commit.Sha) && commit.Status != models.StatusMerged {
+ if branchHeadsToVisualize.Includes(commit.Sha) &&
+ // 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
+ !(commit.IsTODO() && hasRebaseUpdateRefsConfig) {
tagString = style.FgCyan.SetBold().Sprint(
lo.Ternary(icons.IsIconEnabled(), icons.BRANCH_ICON, "*") + " " + tagString)
}
diff --git a/pkg/integration/tests/interactive_rebase/dont_show_branch_heads_for_todo_items.go b/pkg/integration/tests/interactive_rebase/dont_show_branch_heads_for_todo_items.go
index 7c7037188..7b433fa17 100644
--- a/pkg/integration/tests/interactive_rebase/dont_show_branch_heads_for_todo_items.go
+++ b/pkg/integration/tests/interactive_rebase/dont_show_branch_heads_for_todo_items.go
@@ -45,7 +45,7 @@ var DontShowBranchHeadsForTodoItems = NewIntegrationTest(NewIntegrationTestArgs{
Contains("pick").Contains("CI commit 08"),
Contains("pick").Contains("CI commit 07"),
Contains("update-ref").Contains("branch2"),
- Contains("pick").Contains("CI * commit 06"), // the star is undesired here; it's confusing because of the update-ref right above
+ Contains("pick").Contains("CI commit 06"), // no star on this entry, even though branch2 points to it
Contains("pick").Contains("CI commit 05"),
Contains("CI <-- YOU ARE HERE --- commit 04"),
Contains("CI commit 03"),
diff --git a/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go b/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go
index afc0fd073..94e851efa 100644
--- a/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go
+++ b/pkg/integration/tests/interactive_rebase/drop_todo_commit_with_update_ref.go
@@ -44,7 +44,7 @@ var DropTodoCommitWithUpdateRef = NewIntegrationTest(NewIntegrationTestArgs{
Contains("pick").Contains("CI commit 06"),
Contains("pick").Contains("CI commit 05"),
Contains("update-ref").Contains("branch1").DoesNotContain("*"),
- Contains("pick").Contains("CI * commit 04"),
+ Contains("pick").Contains("CI commit 04"),
Contains("pick").Contains("CI commit 03"),
Contains("<-- YOU ARE HERE --- commit 02").IsSelected(),
Contains("CI commit 01"),
diff --git a/pkg/integration/tests/interactive_rebase/quick_start_keep_selection.go b/pkg/integration/tests/interactive_rebase/quick_start_keep_selection.go
index 2216b89b7..ba694b222 100644
--- a/pkg/integration/tests/interactive_rebase/quick_start_keep_selection.go
+++ b/pkg/integration/tests/interactive_rebase/quick_start_keep_selection.go
@@ -43,7 +43,7 @@ var QuickStartKeepSelection = NewIntegrationTest(NewIntegrationTestArgs{
Contains("pick").Contains("CI commit 06"),
Contains("pick").Contains("CI commit 05"),
Contains("update-ref").Contains("branch1"),
- Contains("pick").Contains("CI * commit 04"),
+ Contains("pick").Contains("CI commit 04"),
Contains("pick").Contains("CI commit 03"),
Contains("CI commit 02").IsSelected(),
Contains("CI <-- YOU ARE HERE --- commit 01"),
diff --git a/pkg/integration/tests/interactive_rebase/quick_start_keep_selection_range.go b/pkg/integration/tests/interactive_rebase/quick_start_keep_selection_range.go
index 20005ba6b..ea863e408 100644
--- a/pkg/integration/tests/interactive_rebase/quick_start_keep_selection_range.go
+++ b/pkg/integration/tests/interactive_rebase/quick_start_keep_selection_range.go
@@ -46,10 +46,10 @@ var QuickStartKeepSelectionRange = NewIntegrationTest(NewIntegrationTestArgs{
Contains("CI commit 07"),
Contains("CI commit 06"),
Contains("update-ref").Contains("branch2"),
- Contains("CI * commit 05"),
+ Contains("CI commit 05"),
Contains("CI commit 04").IsSelected(),
Contains("update-ref").Contains("branch1").IsSelected(),
- Contains("CI * commit 03").IsSelected(),
+ Contains("CI commit 03").IsSelected(),
Contains("CI commit 02").IsSelected(),
Contains("CI <-- YOU ARE HERE --- commit 01"),
)
diff --git a/pkg/integration/tests/interactive_rebase/view_files_of_todo_entries.go b/pkg/integration/tests/interactive_rebase/view_files_of_todo_entries.go
index 1b35abaaf..837c418d0 100644
--- a/pkg/integration/tests/interactive_rebase/view_files_of_todo_entries.go
+++ b/pkg/integration/tests/interactive_rebase/view_files_of_todo_entries.go
@@ -30,7 +30,7 @@ var ViewFilesOfTodoEntries = NewIntegrationTest(NewIntegrationTestArgs{
Lines(
Contains("pick").Contains("CI commit 03").IsSelected(),
Contains("update-ref").Contains("branch1"),
- Contains("pick").Contains("CI * commit 02"),
+ Contains("pick").Contains("CI commit 02"),
Contains("CI <-- YOU ARE HERE --- commit 01"),
).
Press(keys.Universal.GoInto)