From: Jonathan Nieder <jrnieder@gmail.com>
To: Kevin Leung <kevinlsk@gmail.com>
Cc: git@vger.kernel.org, Simon Hausmann <simon@lst.de>, gitster@pobox.com
Subject: Re: [PATCH] git-p4: Fix empty submit template when editor fires up
Date: Sun, 10 Jan 2010 05:11:53 -0600 [thread overview]
Message-ID: <20100110111153.GA19612@progeny.tock> (raw)
In-Reply-To: <1262235876-1239-1-git-send-email-kevinlsk@gmail.com>
Kevin Leung wrote:
> read_pipe() returns "\n". We need to remove it before passing it
> to system().
>
> Signed-off-by: Kevin Leung <kevinlsk@gmail.com>
If I understand correctly, this is a cosmetic change: os.system()
calls system(3), which uses 'sh -c', which has no problem coping with
an extra newline at the end. So 'need' seems too strong a word.
Still, the change sounds sensible.
> ---
> contrib/fast-import/git-p4 | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index 0cef242..04bf4f4 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -732,8 +732,8 @@ class P4Submit(Command):
> if os.environ.has_key("P4EDITOR"):
> editor = os.environ.get("P4EDITOR")
> else:
> - editor = read_pipe("git var GIT_EDITOR")
> - system(editor + " " + fileName)
> + editor = read_pipe("git var GIT_EDITOR").strip()
> + system("%s %s" % (editor, fileName))
>
> response = "y"
> if os.stat(fileName).st_mtime <= mtime:
> --
What is the rationale for the rewritten system() line? I would have
understood a change to
os.spawnlp("sh", "-c", editor + " \"$@\"", fileName)
for better behavior when TMPDIR contains shell metacharacters, but
even this has nothing to do with read_pipe() returning a trailing
newline.
Just my two cents,
Jonathan
next parent reply other threads:[~2010-01-10 11:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1262235876-1239-1-git-send-email-kevinlsk@gmail.com>
2010-01-10 11:11 ` Jonathan Nieder [this message]
2010-01-10 11:14 ` [PATCH] git-p4: Fix empty submit template when editor fires up Jonathan Nieder
2010-01-10 13:52 ` Kevin Leung
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=20100110111153.GA19612@progeny.tock \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kevinlsk@gmail.com \
--cc=simon@lst.de \
/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).