diff mbox

[maintainer-tools,1/7] dim: don't run add-missing-cc on merge commits

Message ID 20170809111101.11315-1-eric.engestrom@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Engestrom Aug. 9, 2017, 11:10 a.m. UTC
get_maintainer.pl needs a diff, so this script can't run on a merge
commit.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
---
 dim | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jani Nikula Aug. 9, 2017, 12:55 p.m. UTC | #1
On Wed, 09 Aug 2017, Eric Engestrom <eric.engestrom@imgtec.com> wrote:
> get_maintainer.pl needs a diff, so this script can't run on a merge
> commit.
>
> Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
> ---
>  dim | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/dim b/dim
> index 619d855b321b..af1baa11c7b2 100755
> --- a/dim
> +++ b/dim
> @@ -1960,6 +1960,11 @@ function dim_fixes
>  
>  function dim_add_missing_cc
>  {
> +	if [ $(git cat-file -p HEAD | grep -cE ^parent) -ne 1 ]; then
> +		echoerr "This script doesn't work on merge commits"

To be pedantic, it's the subcommand that fails on merges, not the
script.

> +		return

Please return 1.

BR,
Jani.

> +	fi
> +
>  	git show | scripts/get_maintainer.pl --email --norolestats --pattern-depth 1 | while read cc; do
>  		email="$(echo "$cc" | sed -e 's/.*<//' -e 's/>.*//')"
>  		name=''
diff mbox

Patch

diff --git a/dim b/dim
index 619d855b321b..af1baa11c7b2 100755
--- a/dim
+++ b/dim
@@ -1960,6 +1960,11 @@  function dim_fixes
 
 function dim_add_missing_cc
 {
+	if [ $(git cat-file -p HEAD | grep -cE ^parent) -ne 1 ]; then
+		echoerr "This script doesn't work on merge commits"
+		return
+	fi
+
 	git show | scripts/get_maintainer.pl --email --norolestats --pattern-depth 1 | while read cc; do
 		email="$(echo "$cc" | sed -e 's/.*<//' -e 's/>.*//')"
 		name=''