Skip to contentSkip to conversation

dim: Automatically sign-off patches from others

PATCH Superseded Tvrtko Ursulin 2 participants 3 messages Jan 25, 2016 – Jan 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dim: Automatically sign-off patches from others

From: Tvrtko Ursulin <[email protected]>

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

---
 dim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
dim +5 -1
index c749cebd1187..ff5d89ca5df8 100755
@@ -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"
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 16 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

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

---
 dim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
dim +0 -0
index c749cebd1187..ff5d89ca5df8 100755

dim function dim_apply · line 385

Quoted 7 lines
dim +3 -1
@@ -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

Quoted 8 lines
dim +2 -0
+
+	cat $file | git am -3 $sob "$@"
 
 	if [ -n "$message_id" ]; then
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
Signature · 1 line
1.9.1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v2 1/1 dim: Automatically sign-off patches from others

From: Tvrtko Ursulin <[email protected]>

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

v2: Missed to make sob variable local and align with dim
coding style. (Daniel Vetter)

---
 ...utomatically-sign-off-patches-from-others.patch | 34 ++++++++++++++++++++++
 dim                                                |  9 +++++-
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 0001-dim-Automatically-sign-off-patches-from-others.patch
0001-dim-Automatically-sign-off-patches-from-others.patch new file +34 -0
new file mode 100644
index 000000000000..2e9e4bfb39be
@@ -0,0 +1,34 @@
+From d14e55a4fb687a1237b1251bcc3d5cc29e1a7f5e Mon Sep 17 00:00:00 2001
+From: Tvrtko Ursulin <[email protected]>
+Date: Mon, 25 Jan 2016 17:23:34 +0000
+Subject: [PATCH] dim: Automatically sign-off patches from others
+
+It is very easy to forget that commiters should sign-off
+patches not authored by themselves.
+
+Signed-off-by: Tvrtko Ursulin <[email protected]>
+Cc: Daniel Vetter <[email protected]>
+---
+ 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
++
++	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
+
dim +8 -1
index c749cebd1187..7d1d7b1952f8 100755
@@ -380,7 +380,14 @@ 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)
+	local sob
+	if [[ "$patch_from" != *"$commiter_email"* ]] ; then
+		sob=-s
+	fi
+
+	cat $file | git am -3 $sob "$@"
 
 	if [ -n "$message_id" ]; then
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx