aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-03-02 15:24:01 -0800
committerJunio C Hamano <junkio@cox.net>2006-03-02 15:24:01 -0800
commit64bc6e3db54ef9e2accfdb8e6c8168f789946fcb (patch)
tree48eeaef44a1d278e4f7fb8e69869308bd43aa502 /revision.c
parent7ae0b0cb65f069b657155abcb6aa6780b93ce881 (diff)
downloadgit-64bc6e3db54ef9e2accfdb8e6c8168f789946fcb.tar.gz
git-64bc6e3db54ef9e2accfdb8e6c8168f789946fcb.tar.xz
setup_revisions(): handle -n<n> and -<n> internally.
This moves the handling of max-count shorthand from the internal implementation of "git log" to setup_revisions() so other users of setup_revisions() can use it. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index 488587142..a3df81007 100644
--- a/revision.c
+++ b/revision.c
@@ -482,6 +482,21 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
revs->max_count = atoi(arg + 12);
continue;
}
+ /* accept -<digit>, like traditilnal "head" */
+ if ((*arg == '-') && isdigit(arg[1])) {
+ revs->max_count = atoi(arg + 1);
+ continue;
+ }
+ if (!strcmp(arg, "-n")) {
+ if (argc <= i + 1)
+ die("-n requires an argument");
+ revs->max_count = atoi(argv[++i]);
+ continue;
+ }
+ if (!strncmp(arg,"-n",2)) {
+ revs->max_count = atoi(arg + 2);
+ continue;
+ }
if (!strncmp(arg, "--max-age=", 10)) {
revs->max_age = atoi(arg + 10);
revs->limited = 1;