git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/1] p4 unshelve: fix "Not a valid object name HEAD0" on Windows

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 29, 2019, 11:41 UTC
Message-ID
<nycvar.QRO.7.76.6.1905291341060.44@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqq7eaa1fjt.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Tue, 28 May 2019, Junio C Hamano wrote:
Show 33 quoted lines
> "Mike Mueller via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > 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"
I think you're right!

In addition, I wonder whether we would want to replace the `^` by a `~`, which would have the same effect, but does not need quoting in Bash nor CMD.

Ciao, Dscho

Previous: Junio C Hamano
Message 7 of 7 in “p4: fix "Not a valid object name HEAD0" when unshelving”
  1. 0/1 p4: fix "Not a valid object name HEAD0" when unshelvingMike Mueller via GitGitGadget, May 10, 2019
  2. 1/1 p4 unshelve: fix "Not a valid object name HEAD0"Mike Mueller via GitGitGadget, May 10, 2019
  3. Junio C HamanoMay 15, 2019
  4. 0/1 p4: fix "Not a valid object name HEAD0" when unshelvingMike Mueller via GitGitGadget, May 28, 2019
  5. 1/1 p4 unshelve: fix "Not a valid object name HEAD0" on WindowsMike Mueller via GitGitGadget, May 28, 2019
  6. Junio C HamanoMay 28, 2019
  7. Johannes SchindelinMay 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.