Skip to content

Commit eab58f1

Browse files
jrngitster
authored andcommitted
Handle more shell metacharacters in editor names
Pass the editor name to the shell if it contains any susv3 shell special character (globs, redirections, variable substitutions, escapes, etc). This way, the meaning of some characters will not meaninglessly change when others are added, and git commands implemented in C and in shell scripts will interpret editor names in the same way. This does not make the GIT_EDITOR setting any more expressive, since one could always use single quotes to force the editor to be passed to the shell. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent cd0f8e6 commit eab58f1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

editor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en
2828
const char *args[6];
2929
struct strbuf arg0 = STRBUF_INIT;
3030

31-
if (strcspn(editor, "$ \t'") != len) {
31+
if (strcspn(editor, "|&;<>()$`\\\"' \t\n*?[#~=%") != len) {
3232
/* there are specials */
3333
strbuf_addf(&arg0, "%s \"$@\"", editor);
3434
args[i++] = "sh";

0 commit comments

Comments
 (0)