From: Eric Wong Date: Mon, 30 Jan 2006 00:28:02 +0000 (-0800) Subject: rev-list: allow - as shorthand for --max-count= X-Git-Tag: v1.2.0~87 X-Git-Url: https://git.octo.it/?p=git.git;a=commitdiff_plain;h=8233340ce6eb700eb2cd9c0fef4d1705997c499b rev-list: allow - as shorthand for --max-count= This builds on top of the previous one. Traditionally, head(1) and tail(1) allow their line limits to be parsed this way. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- diff --git a/rev-list.c b/rev-list.c index 45657552..1bc1887f 100644 --- a/rev-list.c +++ b/rev-list.c @@ -749,6 +749,11 @@ int main(int argc, const char **argv) struct commit *commit; unsigned char sha1[20]; + /* accept -, like traditilnal "head" */ + if ((*arg == '-') && isdigit(arg[1])) { + max_count = atoi(arg + 1); + continue; + } if (!strcmp(arg, "-n")) { if (++i >= argc) die("-n requires an argument"); diff --git a/rev-parse.c b/rev-parse.c index 3c99a79e..6bf205a8 100644 --- a/rev-parse.c +++ b/rev-parse.c @@ -53,6 +53,10 @@ static int is_rev_argument(const char *arg) }; const char **p = rev_args; + /* accept -, like traditional "head" */ + if ((*arg == '-') && isdigit(arg[1])) + return 1; + for (;;) { const char *str = *p++; int len;