git-p4: Fix empty submit template when editor fires up
Quoted 4 lines · Kevin Leung
read_pipe()returns "\n". We need to remove it before passing it tosystem().Signed-off-by Kevin Leung <[email protected]>
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.
Quoted 10 lines
--- contrib/fast-import/git-p4 | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)contrib/fast-import/git-p4 +0
-0
contrib/fast-import/git-p4 class P4Submit(Command): · line 739
Quoted 10 lines
contrib/fast-import/git-p4 +2
-2@@ -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
Jonathan Nieder
Acked-byQuoted 7 lines · Jonathan Nieder
Quoted 4 lines · Kevin Leung
read_pipe()returns "\n". We need to remove it before passing it tosystem().Signed-off-by Kevin Leung <[email protected]>If I understand correctly, this is a cosmetic change:
... and of course I didn't the subject. Sorry about that. Thanks for cleaning up my mess.
Quoted 4 lines
What is the rationale for the rewritten
system()line? I would have understood a change toos.spawnlp("sh", "-c", editor + " \"$@\"", fileName)
I am still curious about this, though it is not so important.
Jonathan
Quoted 12 lines · Jonathan Nieder
Quoted 7 lines · Jonathan Nieder
Quoted 4 lines · Kevin Leung
read_pipe()returns "\n". We need to remove it before passing it tosystem().Signed-off-by Kevin Leung <[email protected]>If I understand correctly, this is a cosmetic change:
... and of course I didn't the subject. Sorry about that. Thanks for cleaning up my mess.
Quoted 8 lines
Acked-by Jonathan Nieder <[email protected]>Quoted 4 lines
What is the rationale for the rewritten
system()line? I would have understood a change to
os.spawnlp("sh", "-c", editor + " \"$@\"", fileName)I am still curious about this, though it is not so important.
You are right, the system() line is not so important. I can revert that line of change.
Kevin