Skip to content

Commit

Permalink
Always show approvals first for consistency (even when optional)
Browse files Browse the repository at this point in the history
  • Loading branch information
Djuuu committed Apr 30, 2024
1 parent 20acac9 commit 1a51c1e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions git-mr
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ mr_print_status() {
local approvals_obtained="${approvals%%/*}" # remove '/' and after
approvals_obtained="${approvals_obtained#* }" # remove ' ' and before

local approvals_display approvals_color
local approvals_display approvals_color approvals_spacer

if [[ $approvals_required -gt 0 || $approvals_obtained -gt 0 ]]; then

Expand All @@ -1230,10 +1230,10 @@ mr_print_status() {
if [[ $approvals_required -gt 0 ]]; then
approvals_display="${approvals_display}/$(colorize "$approvals_required" "bold")"
else
approvals_display="${approvals_display} "
approvals_spacer=" "
fi
else
approvals_display=" "
approvals_spacer=" "
fi

# Threads
Expand Down Expand Up @@ -1331,17 +1331,15 @@ mr_print_status() {
echo

# 2nd row ------------------------------------------------------------------
# Approvals (required)
if [[ $approvals_required -gt 0 ]]; then
# Approvals
if [[ -n $approvals_display ]]; then
echo -en " ${approvals_display}"
fi
# Votes
echo -en " \U0001F44D ${upvotes}"
echo -en " \U0001F44E ${downvotes}"
# Approvals (optional)
if [[ $approvals_required -eq 0 ]]; then
echo -en " ${approvals_display}"
fi
# Approvals spacer (when absent or optional)
echo -en "${approvals_spacer}"
# Threads
if [[ $thread_count -gt 0 ]]; then
echo -n " Threads: ${threads_display} "
Expand Down
2 changes: 1 addition & 1 deletion test/git-mr.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ sha_link() {
🏷 [Review] [My Team] 🚧 Draft (↣ main)
👍 1 👎 1 1 Threads: 1/2 CI: ❌ Can be merged: ❌
1 👍 1 👎 1 Threads: 1/2 CI: ❌ Can be merged: ❌
EOF
)"

Expand Down

0 comments on commit 1a51c1e

Please sign in to comment.