aboutsummaryrefslogtreecommitdiff
path: root/rev-parse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-02-05 11:58:34 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-05 13:44:59 -0800
commit9523a4c2fcd7bbccbbddb998eef891ae83cf91a3 (patch)
treea405858a97f95ca8fbecfa782f55d5e0b8bd39ad /rev-parse.c
parent7334f06ce6c53e161d1c183a5f93a23992b3c440 (diff)
downloadgit-9523a4c2fcd7bbccbbddb998eef891ae83cf91a3.tar.gz
git-9523a4c2fcd7bbccbbddb998eef891ae83cf91a3.tar.xz
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>
Diffstat (limited to 'rev-parse.c')
-rw-r--r--rev-parse.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/rev-parse.c b/rev-parse.c
index 6bf205a8f..9cec33b8c 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -107,12 +107,15 @@ static void show_rev(int type, const unsigned char *sha1, const char *name)
}
/* Output a flag, only if filter allows it. */
-static void show_flag(char *arg)
+static int show_flag(char *arg)
{
if (!(filter & DO_FLAGS))
- return;
- if (filter & (is_rev_argument(arg) ? DO_REVS : DO_NOREV))
+ return 0;
+ if (filter & (is_rev_argument(arg) ? DO_REVS : DO_NOREV)) {
show(arg);
+ return 1;
+ }
+ return 0;
}
static void show_default(void)
@@ -296,9 +299,8 @@ int main(int argc, char **argv)
show_datestring("--min-age=", arg+8);
continue;
}
- if (verify)
+ if (show_flag(arg) && verify)
die("Needed a single revision");
- show_flag(arg);
continue;
}