summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorMike Mueller <mike.mueller@moodys.com>2019-05-28 18:15:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-28 20:32:20 (GMT)
commitc3f2358de39a8ac754ae68880a992835a84a6f0c (patch)
treee311f7e3d8f4df3676b8ea61c0e2694258769d49 /git-p4.py
parentaeb582a98374c094361cba1bd756dc6307432c42 (diff)
downloadgit-c3f2358de39a8ac754ae68880a992835a84a6f0c.zip
git-c3f2358de39a8ac754ae68880a992835a84a6f0c.tar.gz
git-c3f2358de39a8ac754ae68880a992835a84a6f0c.tar.bz2
p4 unshelve: fix "Not a valid object name HEAD0" on Windows
git p4 unshelve was failing with these errors: fatal: Not a valid object name HEAD0 Command failed: git cat-file commit HEAD^0 (git version 2.21.0.windows.1, python 2.7.16) The pOpen call used by git-p4 to invoke the git command can take either a string or an array as a first argument. The array form is preferred because platform-specific escaping of special characters will be handled automatically.(https://docs.python.org/2/library/subprocess.html) The extractLogMessageFromGitCommit method was, however, using the string form and so the caret (^) character in the HEAD^0 argument was not being escaped on Windows. The caret happens to be the escape character, which is why the git command was receiving HEAD0. The behaviour can be confirmed by typing ECHO HEAD^0 at the command- prompt, which emits HEAD0. The solution is simply to use the array format of passing the command to fOpen, which is recommended and used in other parts of this code anyway. Signed-off-by: Mike Mueller <mike.mueller@moodys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-p4.py b/git-p4.py
index 5b79920..0b5bfcb 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -737,7 +737,7 @@ def extractLogMessageFromGitCommit(commit):
## fixme: title is first line of commit, not 1st paragraph.
foundTitle = False
- for log in read_pipe_lines("git cat-file commit %s" % commit):
+ for log in read_pipe_lines(["git", "cat-file", "commit", commit]):
if not foundTitle:
if len(log) == 1:
foundTitle = True