Re: [PATCH v2 1/1] p4 unshelve: fix "Not a valid object name HEAD0" on Windows
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 28, 2019, 20:37 UTC
- Message-ID
- <xmqq7eaa1fjt.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <5e89d1aceb9125231797a355e9465d1a41a1741c.1559067344.git.gitgitgadget@gmail.com>
"Mike Mueller via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 17 quoted lines
> From: Mike Mueller <mike.mueller@moodys.com> > > 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.
In the output from
git grep 'read_pipe_lines("'together with a few hits to harmless constant command line, we find this line
diff = read_pipe_lines("git diff-tree -r %s \"%s^\" \"%s\"" % (self.diffOpts, id, id))Would the caret we see there cause a similar problem? It would end up running something like
$ git diff-tree -r -M "HEAD^" "HEAD"