* [igt-dev] [PATCH 1/3] dim: pass git directory via parameter in dim cite, don't cd
@ 2019-01-14 11:41 Jani Nikula
2019-01-14 11:41 ` [igt-dev] [PATCH 2/3] dim: improve error messages in push branch checks Jani Nikula
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jani Nikula @ 2019-01-14 11:41 UTC (permalink / raw)
To: igt-dev; +Cc: Jani Nikula
Make dim_cite safer to use within dim.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
dim | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dim b/dim
index b2fddff1010c..9aac817be567 100755
--- a/dim
+++ b/dim
@@ -2275,9 +2275,8 @@ function dim_cite
sha1=${1:?$usage}
- cd $DIM_PREFIX/$DIM_REPO
-
- git log -1 $sha1 "--pretty=format:%H (\"%s\")%n" | \
+ git --git-dir="$DIM_PREFIX/$DIM_REPO/.git" log -1 $sha1 \
+ "--pretty=format:%H (\"%s\")%n" | \
sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
}
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [igt-dev] [PATCH 2/3] dim: improve error messages in push branch checks
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 ` Jani Nikula
2019-01-14 11:41 ` [igt-dev] [PATCH 3/3] dim: add safeguards for users pushing too many commits at once Jani Nikula
2019-01-14 15:24 ` [igt-dev] [PATCH 1/3] dim: pass git directory via parameter in dim cite, don't cd Jani Nikula
2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2019-01-14 11:41 UTC (permalink / raw)
To: igt-dev; +Cc: Jani Nikula
Use dim_cite() to produce pretty commit message references. Unify and
improve error messages while at it.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
dim | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/dim b/dim
index 9aac817be567..ac100f07a7e4 100755
--- a/dim
+++ b/dim
@@ -805,12 +805,14 @@ function dim_rebuild_tip
# additional patch checks before pushing, e.g. for r-b tags
function checkpatch_commit_push
{
- local sha1 managed_branch rv author committer author_outlook
+ local sha1 managed_branch rv author committer author_outlook cite
sha1=$1
managed_branch=$2
rv=0
+ cite=$(dim_cite $sha1)
+
# use real names for people with many different email addresses
author=$(git show -s $sha1 --format="format:%an")
committer=$(git show -s $sha1 --format="format:%cn")
@@ -819,26 +821,26 @@ function checkpatch_commit_push
# check for author sign-off
if ! git show -s $sha1 | grep -qi "Signed-off-by:.*\\($author\\|$author_outlook\\)" ; then
- echoerr "$sha1 is lacking author of sign-off"
+ echoerr "$cite: author Signed-off-by missing."
rv=1
fi
# check for committer sign-off
if ! git show -s $sha1 | grep -qi "Signed-off-by:.*$committer" ; then
- echoerr "$sha1 is lacking committer of sign-off"
+ echoerr "$cite: committer Signed-off-by missing."
rv=1
fi
# check for Link tag
if [[ "$managed_branch" = "1" ]] && ! git show -s $sha1 | grep -qi 'Link:' ; then
- echoerr "$sha1 is lacking of link tag"
+ echoerr "$cite: Link tag missing."
rv=1
fi
# check for a-b/r-b tag
if ! git show -s $sha1 | grep -qi '\(reviewed\|acked\)\S*-by:' && \
! [[ "$committer" != "$author" ]]; then
- echoerr "$sha1 is lacking mandatory review"
+ echoerr "$cite: mandatory review missing."
rv=1
fi
@@ -847,16 +849,18 @@ function checkpatch_commit_push
function checkmerge_commit_push
{
- local sha1 managed_branch rv body_text
+ local sha1 managed_branch rv body_text cite
sha1=$1
managed_branch=${2}
rv=0
+ cite=$(dim_cite $sha1)
+
body_text="$(git show $sha1 -s --format="format:%b" | grep -v "^$" | grep -v "^\S*:")"
if [[ -z "$body_text" ]] ; then
- echoerr "$sha1 is lacking merge commit justification"
+ echoerr "$cite: merge commit justification missing."
rv=1
fi
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [igt-dev] [PATCH 3/3] dim: add safeguards for users pushing too many commits at once
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
2019-01-14 15:24 ` [igt-dev] [PATCH 1/3] dim: pass git directory via parameter in dim cite, don't cd Jani Nikula
2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2019-01-14 11:41 UTC (permalink / raw)
To: igt-dev; +Cc: Jani Nikula
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [igt-dev] [PATCH 1/3] dim: pass git directory via parameter in dim cite, don't cd
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 ` [igt-dev] [PATCH 3/3] dim: add safeguards for users pushing too many commits at once Jani Nikula
@ 2019-01-14 15:24 ` Jani Nikula
2 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2019-01-14 15:24 UTC (permalink / raw)
To: igt-dev
This series obviously sent to the wrong list. Resubmitted to dim-tools.
Sorry for the noise.
BR,
Jani.
On Mon, 14 Jan 2019, Jani Nikula <jani.nikula@intel.com> wrote:
> Make dim_cite safer to use within dim.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> dim | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/dim b/dim
> index b2fddff1010c..9aac817be567 100755
> --- a/dim
> +++ b/dim
> @@ -2275,9 +2275,8 @@ function dim_cite
>
> sha1=${1:?$usage}
>
> - cd $DIM_PREFIX/$DIM_REPO
> -
> - git log -1 $sha1 "--pretty=format:%H (\"%s\")%n" | \
> + git --git-dir="$DIM_PREFIX/$DIM_REPO/.git" log -1 $sha1 \
> + "--pretty=format:%H (\"%s\")%n" | \
> sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
> }
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-14 15:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [igt-dev] [PATCH 3/3] dim: add safeguards for users pushing too many commits at once Jani Nikula
2019-01-14 15:24 ` [igt-dev] [PATCH 1/3] dim: pass git directory via parameter in dim cite, don't cd Jani Nikula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox