Fix git-rev-parse over-eager errors
Using "--verify" together with "--no-flags" makes perfect sense, but git-rev-parse would complain about it when it saw a flag, even though it would never actually use/output that flag. This fixes it. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Linus Torvalds committed
Feb 5, 2006 at 11:58 UTC
9523a4c2fcd7bbccbbddb998eef891ae83cf91a3
1 file changed
+7
-5
rev-parse.c
+7
-5
@@ -107,12 +107,15 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
107
}
108
109
/* Output a flag, only if filter allows it. */
110
-static void show_flag(char *arg)
110
+static int show_flag(char *arg)
111
{
112
if (!(filter & DO_FLAGS))
113
- return;
114
- if (filter & (is_rev_argument(arg) ? DO_REVS : DO_NOREV))
113
+ return 0;
114
+ if (filter & (is_rev_argument(arg) ? DO_REVS : DO_NOREV)) {
115
show(arg);
116
+ return 1;
117
+ }
118
+ return 0;
119
}
120
121
static void show_default(void)
@@ -296,9 +299,8 @@ int main(int argc, char **argv)
299
show_datestring("--min-age=", arg+8);
300
continue;
301
}
299
- if (verify)
302
+ if (show_flag(arg) && verify)
303
die("Needed a single revision");
301
- show_flag(arg);
304
continue;
305
}
306