From: Luciano Rocha <luciano@eurotux.com>
To: git@vger.kernel.org
Subject: [PATCH v2] builtin-tag.c: allow arguments in $EDITOR
Date: Thu, 20 Dec 2007 09:57:06 +0000 [thread overview]
Message-ID: <20071220095706.GA9685@bit.office.eurotux.com> (raw)
In-Reply-To: <20071219232326.GA4135@bit.office.eurotux.com>
The previous sh version of git-commit evaluated the value of the defined
editor, thus allowing arguments.
Make the builtin version work the same, by adding an explicit check for
arguments in the editor command, and extract them to an additional argument.
Signed-off-by: Luciano Rocha <luciano@eurotux.com>
---
builtin-tag.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
I personally use EDITOR="gvim -f", thus this patch.
Now with free() of temporary buffer.
diff --git a/builtin-tag.c b/builtin-tag.c
index 274901a..0e8575e 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -46,7 +46,19 @@ void launch_editor(const char *path, struct strbuf *buffer, const char *const *e
if (!editor)
editor = "vi";
- if (strcmp(editor, ":")) {
+ if (strstr(editor, " -")) {
+ char *editor_cmd = xstrdup(editor);
+ char *editor_sep = strstr(editor_cmd, " -");
+ const char *args[] = { editor_cmd, editor_sep + 1,
+ path, NULL };
+
+ *editor_sep = '\0';
+
+ if (run_command_v_opt_cd_env(args, 0, NULL, env))
+ die("There was a problem with the editor %s.",
+ editor_cmd);
+ free(editor_cmd);
+ } else if (strcmp(editor, ":")) {
const char *args[] = { editor, path, NULL };
if (run_command_v_opt_cd_env(args, 0, NULL, env))
--
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>
next prev parent reply other threads:[~2007-12-20 9:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-19 23:23 [PATCH] builtin-tag.c: allow arguments in $EDITOR Luciano Rocha
2007-12-20 9:57 ` Luciano Rocha [this message]
2007-12-20 11:58 ` [PATCH v2] " Johannes Schindelin
2007-12-20 12:06 ` Luciano Rocha
2007-12-20 22:14 ` Junio C Hamano
2007-12-21 0:33 ` Steven Grimm
2007-12-22 14:50 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071220095706.GA9685@bit.office.eurotux.com \
--to=luciano@eurotux.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).