mirror of
https://github.com/git/git.git
synced 2024-11-18 15:04:49 +01:00
Merge branch 'lt/rev-list' into next
* lt/rev-list: setup_revisions(): handle -n<n> and -<n> internally.
This commit is contained in:
commit
6f85a78df6
2 changed files with 16 additions and 14 deletions
15
git.c
15
git.c
|
@ -264,20 +264,7 @@ static int cmd_log(int argc, char **argv, char **envp)
|
||||||
argc = setup_revisions(argc, argv, &rev, "HEAD");
|
argc = setup_revisions(argc, argv, &rev, "HEAD");
|
||||||
while (1 < argc) {
|
while (1 < argc) {
|
||||||
char *arg = argv[1];
|
char *arg = argv[1];
|
||||||
/* accept -<digit>, like traditilnal "head" */
|
if (!strncmp(arg, "--pretty", 8)) {
|
||||||
if ((*arg == '-') && isdigit(arg[1])) {
|
|
||||||
rev.max_count = atoi(arg + 1);
|
|
||||||
}
|
|
||||||
else if (!strcmp(arg, "-n")) {
|
|
||||||
if (argc < 2)
|
|
||||||
die("-n requires an argument");
|
|
||||||
rev.max_count = atoi(argv[2]);
|
|
||||||
argc--; argv++;
|
|
||||||
}
|
|
||||||
else if (!strncmp(arg,"-n",2)) {
|
|
||||||
rev.max_count = atoi(arg + 2);
|
|
||||||
}
|
|
||||||
else if (!strncmp(arg, "--pretty", 8)) {
|
|
||||||
commit_format = get_commit_format(arg + 8);
|
commit_format = get_commit_format(arg + 8);
|
||||||
if (commit_format == CMIT_FMT_ONELINE)
|
if (commit_format == CMIT_FMT_ONELINE)
|
||||||
commit_prefix = "";
|
commit_prefix = "";
|
||||||
|
|
15
revision.c
15
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);
|
revs->max_count = atoi(arg + 12);
|
||||||
continue;
|
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)) {
|
if (!strncmp(arg, "--max-age=", 10)) {
|
||||||
revs->max_age = atoi(arg + 10);
|
revs->max_age = atoi(arg + 10);
|
||||||
revs->limited = 1;
|
revs->limited = 1;
|
||||||
|
|
Loading…
Reference in a new issue