object name: introduce '^{/!-<negative pattern>}' notation
To name a commit, you can now use the :/!-<negative pattern> regex style, and consequentially, say $ git rev-parse HEAD^{/!-foo} and it will return the hash of the first commit reachable from HEAD, whose commit message does not contain "foo". This is the opposite of the existing <rev>^{/<pattern>} syntax. The specific use-case this is intended for is to perform an operation, excluding the most-recent commits containing a particular marker. For example, if you tend to make "work in progress" commits, with messages beginning with "WIP", you work, then it could be useful to diff against "the most recent commit which was not a WIP commit". That sort of thing now possible, via commands such as: $ git diff @^{/!-^WIP} The leader '/!-', rather than simply '/!', to denote a negative match, is chosen to leave room for additional modifiers in the future. Signed-off-by: Will Palmer <wmpalmer@gmail.com> Signed-off-by: Stephen P. Smith <ischis2@cox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
06b6b68ff9
commit
0769854f3d
@ -151,11 +151,12 @@ existing tag object.
|
||||
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'.
|
||||
reachable from any ref. The regular expression can match any part of the
|
||||
commit message. To match messages starting with a string, one can use
|
||||
e.g. ':/^foo'. The special sequence ':/!' is reserved for modifiers to what
|
||||
is matched. ':/!-foo' performs a negative match, while ':/!!foo' matches a
|
||||
literal '!' character, followed by 'foo'. Any other sequence beginning with
|
||||
':/!' is reserved for now.
|
||||
|
||||
'<rev>:<path>', e.g. 'HEAD:README', ':README', 'master:./README'::
|
||||
A suffix ':' followed by a path names the blob or tree
|
||||
|
Reference in New Issue
Block a user