diff mbox

dim: Automatically sign-off patches from others

Message ID 1453742829-23266-1-git-send-email-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin Jan. 25, 2016, 5:27 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

It is very easy to forget that commiters should sign-off
patches not authored by themselves.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 dim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Jan. 25, 2016, 6:43 p.m. UTC | #1
On Mon, Jan 25, 2016 at 05:27:09PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> It is very easy to forget that commiters should sign-off
> patches not authored by themselves.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  dim | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/dim b/dim
> index c749cebd1187..ff5d89ca5df8 100755
> --- a/dim
> +++ b/dim
> @@ -380,7 +380,11 @@ function dim_apply
>  
>  	dim_shell_checkpatch "cat $file"
>  
> -	cat $file | git am -3 "$@"
> +	local commiter_email=$(git config --get user.email)
> +	local patch_from=$(grep "From:" "$file" | head -1)
> +	[[ "$patch_from" == *"$commiter_email"* ]] || sob=-s

I'd use real control flow here to hide the sob=-s less. Also

	local sob

With that lgtm.
-Daniel

> +
> +	cat $file | git am -3 $sob "$@"
>  
>  	if [ -n "$message_id" ]; then
>  		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/dim b/dim
index c749cebd1187..ff5d89ca5df8 100755
--- a/dim
+++ b/dim
@@ -380,7 +380,11 @@  function dim_apply
 
 	dim_shell_checkpatch "cat $file"
 
-	cat $file | git am -3 "$@"
+	local commiter_email=$(git config --get user.email)
+	local patch_from=$(grep "From:" "$file" | head -1)
+	[[ "$patch_from" == *"$commiter_email"* ]] || sob=-s
+
+	cat $file | git am -3 $sob "$@"
 
 	if [ -n "$message_id" ]; then
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"