Commit 66bd5be5 authored by Jani Nikula's avatar Jani Nikula
Browse files

dim: add additional prompts for pushing merges

It's not exactly trivial to add the smarts to properly check for pushing
backmerges, rebases, topic branches and subtree branches (such as
gvt). For a start, prompt the user with hints about what's going on.

Cc: Daniel Vetter <>
Acked-by: default avatarRodrigo Vivi <>
Reviewed-by: Daniel Vetter's avatarDaniel Vetter <>
Signed-off-by: Jani Nikula's avatarJani Nikula <>
parent 71e8b401
Pipeline #381976 passed with stages
in 57 seconds
......@@ -989,7 +989,7 @@ function checkpatch_commit_push_range
# push.
function dim_push_branch
local branch remote committer_email count
local branch remote committer_email commit_count merge_count
......@@ -1004,9 +1004,15 @@ function dim_push_branch
# Apart from maintainers pushing merges or rebases, most patches should
# be pushed in small batches.
count=$(git rev-list --count --first-parent "$branch@{u}..$branch")
if [[ $count -gt 10 ]]; then
if ! ask_user "Pushing $count commits. Are you sure?"; then
commit_count=$(git rev-list --count --no-merges --first-parent "$branch@{u}..$branch")
merge_count=$(git rev-list --count --merges --first-parent "$branch@{u}..$branch")
if [[ $merge_count -gt 0 ]]; then
if ! ask_user "Pushing $merge_count merges and $commit_count non-merge commits. Merges should only be pushed by maintainers. Are you sure?"; then
echoerr "NOTE: Branch not pushed."
return 1
elif [[ $commit_count -gt 10 ]]; then
if ! ask_user "Pushing $commit_count commits. Commits should be only be pushed in relatively small batches. Are you sure?"; then
echoerr "NOTE: Branch not pushed."
return 1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment