update comment and documentation for :/foo syntax

The documentation in revisions.txt did not match the implementation, and
the comment in sha1_name.c was incomplete.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Matthieu Moy 2010-09-24 18:43:59 +02:00 committed by Junio C Hamano
parent 3695dc0af1
commit 95ad6d2de1
2 changed files with 4 additions and 1 deletions

View File

@ -107,11 +107,13 @@ the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.
found. found.
* A colon, followed by a slash, followed by a text (e.g. `:/fix nasty bug`): this names * A colon, followed by a slash, followed by a text (e.g. `:/fix nasty bug`): this names
a commit whose commit message starts with the specified text. a commit whose commit message matches the specified regular expression.
This name returns the youngest matching commit which is This name returns the youngest matching commit which is
reachable from any ref. If the commit message starts with a reachable from any ref. If the commit message starts with a
'!', you have to repeat that; the special sequence ':/!', '!', you have to repeat that; the special sequence ':/!',
followed by something else than '!' is reserved for now. 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`.
* A suffix ':' followed by a path (e.g. `HEAD:README`); this names the blob or tree * A suffix ':' followed by a path (e.g. `HEAD:README`); this names the blob or tree
at the given path in the tree-ish object named by the part at the given path in the tree-ish object named by the part

View File

@ -1062,6 +1062,7 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
/* sha1:path --> object name of path in ent sha1 /* sha1:path --> object name of path in ent sha1
* :path -> object name of path in index * :path -> object name of path in index
* :[0-3]:path -> object name of path in index at stage * :[0-3]:path -> object name of path in index at stage
* :/foo -> recent commit matching foo
*/ */
if (name[0] == ':') { if (name[0] == ':') {
int stage = 0; int stage = 0;