From: Jani Nikula <jani.nikula@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [igt-dev] [PATCH 3/3] dim: add safeguards for users pushing too many commits at once
Date: Mon, 14 Jan 2019 13:41:05 +0200 [thread overview]
Message-ID: <20190114114105.6944-3-jani.nikula@intel.com> (raw)
In-Reply-To: <20190114114105.6944-1-jani.nikula@intel.com>
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@intel.com>
---
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
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2019-01-14 11:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-14 11:41 [igt-dev] [PATCH 1/3] dim: pass git directory via parameter in dim cite, don't cd Jani Nikula
2019-01-14 11:41 ` [igt-dev] [PATCH 2/3] dim: improve error messages in push branch checks Jani Nikula
2019-01-14 11:41 ` Jani Nikula [this message]
2019-01-14 15:24 ` [igt-dev] [PATCH 1/3] dim: pass git directory via parameter in dim cite, don't cd Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190114114105.6944-3-jani.nikula@intel.com \
--to=jani.nikula@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox