diff options
-rw-r--r-- | rev-list.c | 5 | ||||
-rw-r--r-- | rev-parse.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/rev-list.c b/rev-list.c index 4565755217..1bc1887fdb 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 -<digit>, 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 3c99a79eb3..6bf205a8f5 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 -<digit>, like traditional "head" */ + if ((*arg == '-') && isdigit(arg[1])) + return 1; + for (;;) { const char *str = *p++; int len; |