summaryrefslogtreecommitdiff
path: root/rev-list.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-01-30 00:28:02 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-02-01 00:23:03 (GMT)
commit8233340ce6eb700eb2cd9c0fef4d1705997c499b (patch)
tree7b3ac058c2f8d702259668e58ef0e281af53579c /rev-list.c
parent3af06987eb3c376e2f1cc6dfa9c9c510b9e228cf (diff)
downloadgit-8233340ce6eb700eb2cd9c0fef4d1705997c499b.zip
git-8233340ce6eb700eb2cd9c0fef4d1705997c499b.tar.gz
git-8233340ce6eb700eb2cd9c0fef4d1705997c499b.tar.bz2
rev-list: allow -<n> as shorthand for --max-count=<n>
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 <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'rev-list.c')
-rw-r--r--rev-list.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rev-list.c b/rev-list.c
index 4565755..1bc1887 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");