Skip to content

Commit 95ad6d2

Browse files
moygitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3695dc0 commit 95ad6d2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Documentation/revisions.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.
107107
found.
108108

109109
* A colon, followed by a slash, followed by a text (e.g. `:/fix nasty bug`): this names
110-
a commit whose commit message starts with the specified text.
110+
a commit whose commit message matches the specified regular expression.
111111
This name returns the youngest matching commit which is
112112
reachable from any ref. If the commit message starts with a
113113
'!', you have to repeat that; the special sequence ':/!',
114114
followed by something else than '!' is reserved for now.
115+
The regular expression can match any part of the commit message. To
116+
match messages starting with a string, one can use e.g. `:/^foo`.
115117

116118
* A suffix ':' followed by a path (e.g. `HEAD:README`); this names the blob or tree
117119
at the given path in the tree-ish object named by the part

sha1_name.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,7 @@ int get_sha1_with_context_1(const char *name, unsigned char *sha1,
10621062
/* sha1:path --> object name of path in ent sha1
10631063
* :path -> object name of path in index
10641064
* :[0-3]:path -> object name of path in index at stage
1065+
* :/foo -> recent commit matching foo
10651066
*/
10661067
if (name[0] == ':') {
10671068
int stage = 0;

0 commit comments

Comments
 (0)