Question

git rev-list --max-count=1 --reverse ':/[git-p4:.*change = 68846]'

While running git-p4, I received this error message right at the end (rats!):

Importing revision 70169 (100%)fatal: ambiguous argument ':/\[git-p4:.*change = 68846\]':  unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
Command failed: ['git', 'rev-list', '--max-count=1', '--reverse', ':/\\[git-p4:.*change = 68846\\]']

The last argument to rev-list should be a commit. I've not seen commit specified quite like this before.

What am I looking at here? What is git-p4 trying to do?

Était-ce utile?

La solution

Answering my own question:

from gitrevisions

:/, e.g. :/fix nasty bug

A colon, followed by a slash, followed by a text, names a commit whose commit message matches the specified regular expression. This name returns the youngest matching commit which is reachable from any ref. If the commit message starts with a ! you have to repeat that; the special sequence :/!, followed by something else than !, is reserved for now. The regular expression can match any part of the commit message. To match messages starting with a string, one can use e.g. :/^foo.

Although my translation is a bit off. It needs to escape the [].

git rev-list --max-count=1 --reverse ':/\[git-p4:.*change = 68846\]'

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top