@matheusbsbs / matheus-bagliano / commits / 5306968660
Fork 0

revision: simplify argument parsing.

This just moves code around to consolidate the part that sets revs->limited to one place based on various flags. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Apr 1, 2006 at 18:38 UTC 53069686601d156dea3787a100ffc4e35c78040f
1 file changed +7 -13
revision.c
+7 -13
@@ -552,32 +552,26 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
552 }
553 if (!strncmp(arg, "--max-age=", 10)) {
554 revs->max_age = atoi(arg + 10);
555 - revs->limited = 1;
556 - continue;
557 - }
558 - if (!strncmp(arg, "--min-age=", 10)) {
559 - revs->min_age = atoi(arg + 10);
560 - revs->limited = 1;
555 continue;
556 }
557 if (!strncmp(arg, "--since=", 8)) {
558 revs->max_age = approxidate(arg + 8);
565 - revs->limited = 1;
559 continue;
560 }
561 if (!strncmp(arg, "--after=", 8)) {
562 revs->max_age = approxidate(arg + 8);
570 - revs->limited = 1;
563 + continue;
564 + }
565 + if (!strncmp(arg, "--min-age=", 10)) {
566 + revs->min_age = atoi(arg + 10);
567 continue;
568 }
569 if (!strncmp(arg, "--before=", 9)) {
570 revs->min_age = approxidate(arg + 9);
575 - revs->limited = 1;
571 continue;
572 }
573 if (!strncmp(arg, "--until=", 8)) {
574 revs->min_age = approxidate(arg + 8);
580 - revs->limited = 1;
575 continue;
576 }
577 if (!strcmp(arg, "--all")) {
@@ -596,13 +590,11 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
590 }
591 if (!strcmp(arg, "--topo-order")) {
592 revs->topo_order = 1;
599 - revs->limited = 1;
593 continue;
594 }
595 if (!strcmp(arg, "--date-order")) {
596 revs->lifo = 0;
597 revs->topo_order = 1;
605 - revs->limited = 1;
598 continue;
599 }
600 if (!strcmp(arg, "--parents")) {
@@ -644,7 +636,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
636 }
637 if (!strcmp(arg, "--unpacked")) {
638 revs->unpacked = 1;
647 - revs->limited = 1;
639 continue;
640 }
641 *unrecognized++ = arg;
@@ -708,6 +699,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
699 add_one_commit(commit, revs);
700 }
701
702 + if ((revs->max_age != -1) || revs->topo_order || revs->unpacked)
703 + revs->limited = 1;
704 +
705 if (revs->prune_data) {
706 diff_tree_setup_paths(revs->prune_data);
707 revs->prune_fn = try_to_simplify_commit;