Skip to content

Commit

Permalink
Fix $EDITOR regression introduced by rewrite in C.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Dec 22, 2007
1 parent 77190eb commit 5e2de4f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion builtin-tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5e2de4f

Please sign in to comment.