Skip to content

Commit

Permalink
Fix git-rev-parse over-eager errors
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Feb 5, 2006
1 parent 7334f06 commit 9523a4c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions rev-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 9523a4c

Please sign in to comment.