Skip to content

Commit 688b2b3

Browse files
authored
Merge pull request #10494 from gitbutlerapp/kv-branch-55
feat(ui): use variable dot markers and color per commit state for
2 parents 15be044 + 7d836e6 commit 688b2b3

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

crates/but/src/status/mod.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ pub(crate) fn worktree(
122122
i == 0,
123123
)?;
124124
}
125+
let dot = "●".purple();
125126
println!(
126-
" {} (common base) [{}] {}",
127+
" {dot} {} (common base) [{}] {}",
127128
common_merge_base_data.common_merge_base.dimmed(),
128129
common_merge_base_data.target_name.green().bold(),
129130
common_merge_base_data.message
@@ -254,14 +255,26 @@ pub fn print_group(
254255
"".to_string().normal()
255256
};
256257

258+
let dot = match commit.state {
259+
but_workspace::ui::CommitState::LocalOnly => "●".normal(),
260+
but_workspace::ui::CommitState::LocalAndRemote(object_id) => {
261+
if object_id == commit.id {
262+
"●".green()
263+
} else {
264+
"◐".green()
265+
}
266+
}
267+
but_workspace::ui::CommitState::Integrated => "●".purple(),
268+
};
269+
257270
if verbose {
258271
// Verbose format: author and timestamp on first line, message on second line
259272
let datetime = DateTime::from_timestamp_millis(commit.created_at as i64)
260273
.unwrap_or_else(|| Utc.timestamp_millis_opt(0).unwrap());
261274
let formatted_time = datetime.format("%Y-%m-%d %H:%M:%S");
262275

263276
println!(
264-
" {}{} {} {} {} {} {}",
277+
"{dot} {}{} {} {} {} {} {}",
265278
&commit.id.to_string()[..2].blue().underline(),
266279
&commit.id.to_string()[2..7].dimmed(),
267280
commit.author.name,
@@ -274,7 +287,7 @@ pub fn print_group(
274287
} else {
275288
// Original format: everything on one line
276289
println!(
277-
" {}{} {} {} {} {}",
290+
"{dot} {}{} {} {} {} {}",
278291
&commit.id.to_string()[..2].blue().underline(),
279292
&commit.id.to_string()[2..7].dimmed(),
280293
message,

0 commit comments

Comments
 (0)