[PATCH 3/3] dim: add safeguards for users pushing too many commits at once
Jani Nikula
jani.nikula at intel.com
Tue Jan 15 09:33:28 UTC 2019
On Mon, 14 Jan 2019, Rodrigo Vivi <rodrigo.vivi at intel.com> wrote:
> On Mon, Jan 14, 2019 at 05:23:15PM +0200, Jani Nikula wrote:
>> In most cases, even when pushing long series, it's better to push
>> commits in moderately sized batches. One functional reason is resolving
>> potential drm-tip conflicts in smaller and more isolated units, which is
>> easier to resolve, and is less likely to need a new massive conflict
>> resolution later.
>>
>> Ask the user for confirmation when they're trying to push more than
>> (arbitrarily chosen) 10 patches in one go. This also acts as a safeguard
>> for pushing more than the user intended.
>>
>> Obviously maintainers will also face the question when pushing merges or
>> rebases, but there's no harm in that. They also need to be sure this is
>> what they mean.
>>
>> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>
> for the series:
>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
Thanks, pushed the series with --first-parent added to git rev-list
--count per Daniel's irc review.
BR,
Jani.
>
>> ---
>> dim | 12 +++++++++++-
>> 1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/dim b/dim
>> index ac100f07a7e4..64d2bf147647 100755
>> --- a/dim
>> +++ b/dim
>> @@ -892,7 +892,7 @@ function checkpatch_commit_push_range
>> # push.
>> function dim_push_branch
>> {
>> - local branch remote
>> + local branch remote count
>>
>> branch=${1:?$usage}
>> shift
>> @@ -903,6 +903,16 @@ function dim_push_branch
>>
>> checkpatch_commit_push_range 1 "$branch@{u}..$branch" --first-parent
>>
>> + # Apart from maintainers pushing merges or rebases, most patches should
>> + # be pushed in small batches.
>> + count=$(git rev-list --count "$branch@{u}..$branch")
>> + if [[ $count -gt 10 ]]; then
>> + if ! ask_user "Pushing $count commits. Are you sure?"; then
>> + echoerr "NOTE: Branch not pushed."
>> + return 1
>> + fi
>> + fi
>> +
>> git push $DRY_RUN $remote $branch "$@"
>>
>> update_linux_next $branch drm-intel-next-queued drm-intel-next-fixes drm-intel-fixes
>> --
>> 2.20.1
>>
>> _______________________________________________
>> dim-tools mailing list
>> dim-tools at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dim-tools
--
Jani Nikula, Intel Open Source Graphics Center
More information about the dim-tools
mailing list