summaryrefslogtreecommitdiff
path: root/builtin-tag.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-22 17:45:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-12-22 18:26:08 (GMT)
commit5e2de4f9bb666186e4f8ba0c9c5db640fd7a04bd (patch)
tree90f5dee8ca3d2c9e6a5514f3e6137b59a37a5195 /builtin-tag.c
parent77190eb9b881118b78383a483973a85fe79cbf70 (diff)
downloadgit-5e2de4f9bb666186e4f8ba0c9c5db640fd7a04bd.zip
git-5e2de4f9bb666186e4f8ba0c9c5db640fd7a04bd.tar.gz
git-5e2de4f9bb666186e4f8ba0c9c5db640fd7a04bd.tar.bz2
Fix $EDITOR regression introduced by rewrite in C.
When git-tag and git-commit launches the editor, they used to honor EDITOR="editor -options args..." but recent rewrite in C insisted on $EDITOR to be the path to the editor executable. This restores the older behaviour. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-tag.c')
-rw-r--r--builtin-tag.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/builtin-tag.c b/builtin-tag.c
index 020ee1c..03e7015 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -47,7 +47,19 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e
editor = "vi";
if (strcmp(editor, ":")) {
- const char *args[] = { editor, path, NULL };
+ size_t len = strlen(editor);
+ int i = 0;
+ const char *args[6];
+
+ if (strcspn(editor, "$ \t'") != len) {
+ /* there are specials */
+ args[i++] = "sh";
+ args[i++] = "-c";
+ args[i++] = "$0 \"$@\"";
+ }
+ args[i++] = editor;
+ args[i++] = path;
+ args[i] = NULL;
if (run_command_v_opt_cd_env(args, 0, NULL, env))
die("There was a problem with the editor %s.", editor);