Thread (11 messages) flat view 11 messages, 3 authors, 2016-06-15

Re: [PATCH v3] revision: allow selection of commits that do not match a pattern

From: Sven Verdoolaege <hidden>
Date: 2016-06-15 22:43:20

On Sun, Jul 08, 2007 at 03:22:06PM +0100, Johannes Schindelin wrote:
quoted hunk ↗ jump to hunk
@@ -382,6 +391,8 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name,
 	unsigned count = 0;
 	enum grep_context ctx = GREP_CONTEXT_HEAD;
 
+	opt->not_at_all = 0;
+
 	if (buffer_is_binary(buf, size)) {
 		switch (opt->binary) {
 		case GREP_BINARY_DEFAULT:
@@ -500,7 +511,7 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name,
 		return 0;
 
 	if (opt->status_only)
-		return 0;
+		return !opt->not_at_all;
 	if (opt->unmatch_name_only) {
 		/* We did not see any hit, so we want to show this */
 		printf("%s\n", name);
I don't understand this part.
Aren't you changing the return value from 0 to 1 here if there is no NOT_AT_ALL node?
quoted hunk ↗ jump to hunk
@@ -68,6 +70,7 @@ struct grep_opt {
 	unsigned extended:1;
 	unsigned relative:1;
 	unsigned pathname:1;
+	unsigned not_at_all:1; /* is set if the pattern was seen */
 	int regflags;
 	unsigned pre_context;
 	unsigned post_context;
The name for this field is also a bit confusing.
Wouldn't "matched_some_line" or some such by more appropriate?

skimo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help