public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [igt-dev] [PATCH 2/3] dim: improve error messages in push branch checks
Date: Mon, 14 Jan 2019 13:41:04 +0200	[thread overview]
Message-ID: <20190114114105.6944-2-jani.nikula@intel.com> (raw)
In-Reply-To: <20190114114105.6944-1-jani.nikula@intel.com>

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

  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 ` Jani Nikula [this message]
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

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-2-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