зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
3af06987eb
Коммит
8233340ce6
|
@ -749,6 +749,11 @@ int main(int argc, const char **argv)
|
||||||
struct commit *commit;
|
struct commit *commit;
|
||||||
unsigned char sha1[20];
|
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 (!strcmp(arg, "-n")) {
|
||||||
if (++i >= argc)
|
if (++i >= argc)
|
||||||
die("-n requires an argument");
|
die("-n requires an argument");
|
||||||
|
|
|
@ -53,6 +53,10 @@ static int is_rev_argument(const char *arg)
|
||||||
};
|
};
|
||||||
const char **p = rev_args;
|
const char **p = rev_args;
|
||||||
|
|
||||||
|
/* accept -<digit>, like traditional "head" */
|
||||||
|
if ((*arg == '-') && isdigit(arg[1]))
|
||||||
|
return 1;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const char *str = *p++;
|
const char *str = *p++;
|
||||||
int len;
|
int len;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче