git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Make git send-email accept $EDITOR with arguments

From
Gustaf Hendeby <hendeby@isy.liu.se>
Date
Dec 20, 2007, 20:14 UTC
Message-ID
<1198181646-28632-1-git-send-email-hendeby@isy.liu.se>

Currently git send-email does not accept $EDITOR with arguments, eg, emacs -nw, when starting an editor to produce a cover letter. This fixes this in the simplest way possible, assume all spaces separates either the command from the first argument, or two arguments. This should work in most cases, but will break with quoted strings embedded spaces. An example of a problematic case is when there is a space in the path to the command.

Signed-off-by:  Gustaf Hendeby <hendeby@isy.liu.se>
---

This is related to the problems recently observed in the built in git commit and git tag. I guess the behavior of git send-email has been the same from the start, but having it treat $EDITOR substantially different from that of git commit and git tag seems like bug or at least something that should be avoided.

I'm not completely satisfied with the problem with embedded spaces, but my Perl skills aren't good enough to do anything about it. If anyone have any suggestions on how to do it, it would be greatly appreciated. None-the-less, even with this shortcoming, I think this is a step in the right direction.

 git-send-email.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 248d035..47ae77c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -400,7 +400,7 @@ EOT
 	close(C);
 
 	my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi";
-	system($editor, $compose_filename);
+	system((split ' ', $editor), $compose_filename);
 
 	open(C2,">",$compose_filename . ".final")
 		or die "Failed to open $compose_filename.final : " . $!;
-- 
1.5.4.rc1.3.gc641f
Next: Luciano Rocha
Message 1 of 19 in “Make git send-email accept $EDITOR with arguments”
  1. Make git send-email accept $EDITOR with argumentsGustaf Hendeby, Dec 20, 2007
  2. Luciano RochaDec 20, 2007
  3. Make git send-email accept $EDITOR with argumentsGustaf Hendeby, Dec 21, 2007
  4. Jeff KingDec 21, 2007
  5. Gustaf HendebyDec 21, 2007
  6. Jeff KingDec 21, 2007
  7. Gustaf HendebyDec 21, 2007
  8. Junio C HamanoDec 21, 2007
  9. Make git send-email accept $EDITOR with argumentsGustaf Hendeby, Dec 22, 2007
  10. Junio C HamanoDec 22, 2007
  11. Gustaf HendebyDec 22, 2007
  12. Junio C HamanoDec 21, 2007
  13. Move git send-email cover letter temporary file to $GIT_DIRGustaf Hendeby, Dec 22, 2007
  14. Junio C HamanoDec 22, 2007
  15. David SymondsDec 22, 2007
  16. Junio C HamanoDec 22, 2007
  17. David SymondsDec 22, 2007
  18. Junio C HamanoDec 22, 2007
  19. Gustaf HendebyDec 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.