Commit c3ae0473 by Brendan Macmillan

Fix -n bug; default to all ancestors

parent d477a9ab
...@@ -265,6 +265,7 @@ int main(int argc, char *argv[]) ...@@ -265,6 +265,7 @@ int main(int argc, char *argv[])
memset(&opt, 0, sizeof(opt)); memset(&opt, 0, sizeof(opt));
opt.max_parents = -1; opt.max_parents = -1;
opt.limit = -1;
for (i = 1; i < argc; ++i) { for (i = 1; i < argc; ++i) {
a = argv[i]; a = argv[i];
...@@ -294,8 +295,8 @@ int main(int argc, char *argv[]) ...@@ -294,8 +295,8 @@ int main(int argc, char *argv[])
if (!match_int(&opt.limit, a + 1, 0)) if (!match_int(&opt.limit, a + 1, 0))
usage("Invalid limit on number of commits", a); usage("Invalid limit on number of commits", a);
} else if (!strcmp(a, "-n")) { } else if (!strcmp(a, "-n")) {
if (i + 1 == argc || !match_int(&opt.limit, argv[i], 0)) if (i + 1 == argc || !match_int(&opt.limit, argv[i + 1], 0))
usage("Argument -n not followed by valid count", argv[i]); usage("Argument -n not followed by valid count", argv[i + 1]);
else else
++i; ++i;
} }
...@@ -363,7 +364,7 @@ int main(int argc, char *argv[]) ...@@ -363,7 +364,7 @@ int main(int argc, char *argv[])
if (count++ < opt.skip) if (count++ < opt.skip)
continue; continue;
if (printed++ >= opt.limit) { if (opt.limit != -1 && printed++ >= opt.limit) {
git_commit_free(commit); git_commit_free(commit);
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment