Skip to contentSkip to conversation

dim: Remove git commit --amend from dim_apply

PATCH In review Ander Conselvan de Oliveira 9 participants 18 messages Nov 13, 2015 – Dec 17, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dim: Remove git commit --amend from dim_apply

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

---
 dim | 2 --
 1 file changed, 2 deletions(-)
dim +0 -2
index db92c57..893906b 100755
@@ -382,8 +382,6 @@ function dim_apply
 	if [ -n $message_id ]; then
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
 	fi
-
-	git commit --amend &
 }
 
 function magic_patch
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 4 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 8 lines · Chris Wilson
Quoted 4 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

In either case can also consider "test -t 0" which is like isatty(0).

Regards,

Tvrtko

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

#3 lore raw
Quoted 5 lines · Tvrtko Ursulin
Quoted 4 lines · Chris Wilson
Quoted 3 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Signed-off-by: Ander Conselvan de Oliveira <
[email protected]>

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

In either case can also consider "test -t 0" which is like isatty(0).

I think that will always evaluate to false since you are supposed to cat the mbox to dim apply.

Ander

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

#4 lore raw
Quoted 9 lines · Ander Conselvan De Oliveira
Quoted 8 lines · Tvrtko Ursulin
Quoted 7 lines · Chris Wilson
Quoted 5 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

Signed-off-by: Ander Conselvan de Oliveira <
[email protected]>

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

In either case can also consider "test -t 0" which is like isatty(0).

I think that will always evaluate to false since you are supposed to cat the mbox to dim apply.

Question is then how does it work for Daniel. :)

Regards,

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

#5 lore raw
Quoted 15 lines · Tvrtko Ursulin
Quoted 14 lines · Ander Conselvan De Oliveira
Quoted 13 lines · Tvrtko Ursulin
Quoted 11 lines · Chris Wilson
Quoted 6 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies
on the terminal for input. So don't do that from dim_apply.

Signed-off-by: Ander Conselvan de Oliveira <
[email protected]>

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

In either case can also consider "test -t 0" which is like isatty(0).

I think that will always evaluate to false since you are supposed to cat the mbox to dim apply.

Question is then how does it work for Daniel. :)

If I understood correctly he uses gvim, which doesn't run on a terminal.

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

#6 lore raw
Quoted 16 lines · Ander Conselvan De Oliveira
Quoted 15 lines · Tvrtko Ursulin
Quoted 14 lines · Ander Conselvan De Oliveira
Quoted 13 lines · Tvrtko Ursulin
Quoted 11 lines · Chris Wilson
Quoted 6 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies
on the terminal for input. So don't do that from dim_apply.

Signed-off-by: Ander Conselvan de Oliveira <
[email protected]>

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

In either case can also consider "test -t 0" which is like isatty(0).

I think that will always evaluate to false since you are supposed to cat the mbox to dim apply.

Question is then how does it work for Daniel. :)

If I understood correctly he uses gvim, which doesn't run on a terminal.

Yup. And I use git commit --amend to paste in all the r-b/t-b tags and all that stuff. Maybe we need a DIM_POST_APPLY_CMD in .dimrc? -Daniel

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
#7 lore raw
In reply to Chris Wilson
Quoted 9 lines · Chris Wilson
Quoted 5 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

Signed-off-by: Ander Conselvan de Oliveira <
[email protected]>

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

I'm fine with that, but I'd like to have a definitive answer to the question before I resend. Maybe Daniel knows?

Ander

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

#8 lore raw
In reply to Chris Wilson
Quoted 8 lines · Chris Wilson
Quoted 4 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

I don't think there's any reason other than Daniel's gvim workflow.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw
Quoted 11 lines · Ville Syrjälä
Quoted 8 lines · Chris Wilson
Quoted 4 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

I don't think there's any reason other than Daniel's gvim workflow.

Yes, that's it, there's no functional reason other than to fire up an editor to edit the commit message (add r-b, etc.) This always fails for me and I just do this in the cli separately.

Basically three options, just remove it, add tty test suggested by Tvrtko, or add some DIM_POST_APPLY_ACTION configuration. I'm fine with any of them.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw
Quoted 13 lines · Jani Nikula
Quoted 11 lines · Ville Syrjälä
Quoted 8 lines · Chris Wilson
Quoted 4 lines · Ander Conselvan de Oliveira

Calling git --amend invokes the editor, which will not run if it relies on the terminal for input. So don't do that from dim_apply.

Presumable the ammend is there for a good reason and removing it keeps the state dirty? So maybe --amend --no-edit?

I don't think there's any reason other than Daniel's gvim workflow.

Quoted 7 lines

Yes, that's it, there's no functional reason other than to fire up an editor to edit the commit message (add r-b, etc.) This always fails for me and I just do this in the cli separately.

Basically three options, just remove it, add tty test suggested by Tvrtko, or add some DIM_POST_APPLY_ACTION configuration. I'm fine with any of them.

I don't want to amend the commit at this point in my workflow. "dim xt" (should upstream that somehow one of these days...) is what I do after "dim aq", so anything that fires up an editor is no good for me.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 1/1 dim: Replace git commit --amend from dim_apply with dimrc option

In reply to Jani Nikula

Introduce DIM_POST_APPLY_ACTION to dimrc that allows the user to specify a command to be run after a patch is applied. Use eval so enviroment variables can be overriden with the option. For example:

DIM_POST_APPLY_ACTION="EDITOR=\"gedit -w\" git commit --amend"

---
 dim          | 2 +-
 dimrc.sample | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
dim +1 -1
index db92c57..b7c7ef7 100755
@@ -383,7 +383,7 @@ function dim_apply
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
 	fi
 
-	git commit --amend &
+	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
 function magic_patch
dimrc.sample +3 -0
index 5687eaf..9f30cb2 100644
@@ -21,3 +21,6 @@
 # Mail User Agent supporting a subset of mutt(1) command line options:
 # [-s subject] [-i file] [-c cc-addr] to-addr [...]
 #DIM_MUA=mutt
+
+# Command to run after dim apply
+#DIM_POST_APPLY_ACTION=git commit --amend
Signature · 6 lines
2.4.3

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

Re: [PATCH maintainer-tools] dim: Replace git commit --amend from dim_apply with dimrc option

Hi Ander,

Quoted 5 lines · Ander Conselvan de Oliveira

Introduce DIM_POST_APPLY_ACTION to dimrc that allows the user to specify a command to be run after a patch is applied. Use eval so enviroment variables can be overriden with the option. For example:

DIM_POST_APPLY_ACTION="EDITOR=\"gedit -w\" git commit --amend"

So an attacker wishing to smuggle a backdoor into the Linux kernel only needs to find a way to modify that environment variable on an Intel developers' machine.

If dim is invoked with $EDITOR set, this should be inherited to child processes anyway, so it seems unnecessary to call eval.

Just my 2 cents,

Lukas

Quoted 38 lines
---
 dim          | 2 +-
 dimrc.sample | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
dim +1 -1
index db92c57..b7c7ef7 100755
@@ -383,7 +383,7 @@ function dim_apply
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
 	fi
 
-	git commit --amend &
+	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
 function magic_patch
dimrc.sample +3 -0
index 5687eaf..9f30cb2 100644
@@ -21,3 +21,6 @@
 # Mail User Agent supporting a subset of mutt(1) command line options:
 # [-s subject] [-i file] [-c cc-addr] to-addr [...]
 #DIM_MUA=mutt
+
+# Command to run after dim apply
+#DIM_POST_APPLY_ACTION=git commit --amend
Signature · 6 lines
2.4.3

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

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

#13 lore raw

Re: [PATCH maintainer-tools] dim: Replace git commit --amend from dim_apply with dimrc option

In reply to Ander Conselvan de Oliveira
Quoted 30 lines · Ander Conselvan de Oliveira

Introduce DIM_POST_APPLY_ACTION to dimrc that allows the user to specify a command to be run after a patch is applied. Use eval so enviroment variables can be overriden with the option. For example:

DIM_POST_APPLY_ACTION="EDITOR=\"gedit -w\" git commit --amend"

---
 dim          | 2 +-
 dimrc.sample | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
dim +1 -1
index db92c57..b7c7ef7 100755
@@ -383,7 +383,7 @@ function dim_apply
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
 	fi
 
-	git commit --amend &
+	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
 function magic_patch
dimrc.sample +0 -0
index 5687eaf..9f30cb2 100644

dimrc.sample line 26

Quoted 6 lines
dimrc.sample +3 -0
@@ -21,3 +21,6 @@
 # Mail User Agent supporting a subset of mutt(1) command line options:
 # [-s subject] [-i file] [-c cc-addr] to-addr [...]
 #DIM_MUA=mutt
+
+# Command to run after dim apply
+#DIM_POST_APPLY_ACTION=git commit --amend

There's a comment earlier that says "Defaults are in the comments below." I'm fine with changing the default here.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH v2 1/1 dim: Replace git commit --amend from dim_apply with dimrc option

Introduce DIM_POST_APPLY_ACTION to dimrc that allows the user to specify a command to be run after a patch is applied. Use eval so enviroment variables can be overriden with the option. For example:

DIM_POST_APPLY_ACTION="EDITOR=\"gedit -w\" git commit --amend"

v2: Initialize variable with default value.
Fix dimrc.sample to match default value.

---
 dim          | 5 ++++-
 dimrc.sample | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
dim +4 -1
index db92c57..78b3f30 100755
@@ -65,6 +65,9 @@ DIM_DRM_UPSTREAM_REMOTE=${DIM_DRM_UPSTREAM_REMOTE:-airlied}
 # usage: $DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...]
 DIM_MUA=${DIM_MUA:-mutt}
 
+# command to run after dim apply
+DIM_POST_APPLY_ACTION=${DIM_POST_APPLY_ACTION:-}
+
 # greetings pull request template
 DIM_TEMPLATE_HELLO=${DIM_TEMPLATE_HELLO:-$HOME/.dim.template.hello}
 
@@ -383,7 +386,7 @@ function dim_apply
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
 	fi
 
-	git commit --amend &
+	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
 function magic_patch
dimrc.sample +3 -0
index 5687eaf..ad463b4 100644
@@ -21,3 +21,6 @@
 # Mail User Agent supporting a subset of mutt(1) command line options:
 # [-s subject] [-i file] [-c cc-addr] to-addr [...]
 #DIM_MUA=mutt
+
+# Command to run after dim apply
+#DIM_POST_APPLY_ACTION=
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#15 lore raw

Re: [PATCH v2 maintainer-tools] dim: Replace git commit --amend from dim_apply with dimrc option

Quoted 10 lines · Ander Conselvan de Oliveira

Introduce DIM_POST_APPLY_ACTION to dimrc that allows the user to specify a command to be run after a patch is applied. Use eval so enviroment variables can be overriden with the option. For example:

DIM_POST_APPLY_ACTION="EDITOR=\"gedit -w\" git commit --amend"

v2: Initialize variable with default value.
Fix dimrc.sample to match default value.

Quoted 46 lines
---
 dim          | 5 ++++-
 dimrc.sample | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
dim +4 -1
index db92c57..78b3f30 100755
@@ -65,6 +65,9 @@ DIM_DRM_UPSTREAM_REMOTE=${DIM_DRM_UPSTREAM_REMOTE:-airlied}
 # usage: $DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...]
 DIM_MUA=${DIM_MUA:-mutt}
 
+# command to run after dim apply
+DIM_POST_APPLY_ACTION=${DIM_POST_APPLY_ACTION:-}
+
 # greetings pull request template
 DIM_TEMPLATE_HELLO=${DIM_TEMPLATE_HELLO:-$HOME/.dim.template.hello}
 
@@ -383,7 +386,7 @@ function dim_apply
 		commit_add_tag "Link" "http://patchwork.freedesktop.org/patch/msgid/$message_id"
 	fi
 
-	git commit --amend &
+	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
 function magic_patch
dimrc.sample +3 -0
index 5687eaf..ad463b4 100644
@@ -21,3 +21,6 @@
 # Mail User Agent supporting a subset of mutt(1) command line options:
 # [-s subject] [-i file] [-c cc-addr] to-addr [...]
 #DIM_MUA=mutt
+
+# Command to run after dim apply
+#DIM_POST_APPLY_ACTION=
Signature · 6 lines
2.4.3

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
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
#16 lore raw

Re: [PATCH v2 maintainer-tools] dim: Replace git commit --amend from dim_apply with dimrc option

Quoted 7 lines · Daniel Vetter
Quoted 6 lines · Ander Conselvan de Oliveira

Introduce DIM_POST_APPLY_ACTION to dimrc that allows the user to specify a command to be run after a patch is applied. Use eval so enviroment variables can be overriden with the option. For example:

DIM_POST_APPLY_ACTION="EDITOR=\"gedit -w\" git commit --amend"

Quoted 7 lines
Quoted 5 lines

v2: Initialize variable with default value.
Fix dimrc.sample to match default value.

Signed-off-by: Ander Conselvan de Oliveira <
[email protected]>

Thanks. Patch pushed.

Ander

Quoted 45 lines
Quoted 45 lines
---
 dim          | 5 ++++-
 dimrc.sample | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
dim +3 -1
index db92c57..78b3f30 100755
@@ -65,6 +65,9 @@ DIM_DRM_UPSTREAM_REMOTE=${DIM_DRM_UPSTREAM_REMOTE:
-airlied}
 # usage: $DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...]
 DIM_MUA=${DIM_MUA:-mutt}
 
+# command to run after dim apply
+DIM_POST_APPLY_ACTION=${DIM_POST_APPLY_ACTION:-}
+
 # greetings pull request template
 DIM_TEMPLATE_HELLO=${DIM_TEMPLATE_HELLO:-$HOME/.dim.template.hello}
@@ -383,7 +386,7 @@ function dim_apply
 		commit_add_tag "Link" "

http://patchwork.freedesktop.org/patch/msgid/$message_id"

dim +1 -1
 	fi
 
-	git commit --amend &
+	eval $DRY $DIM_POST_APPLY_ACTION
 }
 
 function magic_patch
dimrc.sample +3 -0
index 5687eaf..ad463b4 100644
@@ -21,3 +21,6 @@
 # Mail User Agent supporting a subset of mutt(1) command line options:
 # [-s subject] [-i file] [-c cc-addr] to-addr [...]
 #DIM_MUA=mutt
+
+# Command to run after dim apply
+#DIM_POST_APPLY_ACTION=
Signature · 1 line
2.4.3
Quoted 5 lines
Quoted 4 lines

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

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

#17 lore raw

✗ Fi.CI.BAT: failure for dim: Remove git commit --amend from dim_apply

In reply to Ander Conselvan de Oliveira
== Series Details ==

== Series Details ==

Series: dim: Remove git commit --amend from dim_apply
URL : https://patchwork.freedesktop.org/series/738/
State : failure

== Summary ==

Patch is empty.
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

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