diff options
author | Vicent Martà <vicent@github.com> | 2013-07-27 17:00:21 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-07-27 17:00:21 -0700 |
commit | a873449f1c1f5e803dae139d6d2145ffa94c1118 (patch) | |
tree | d713b82147d75715612267b4aa54fb2572d29c4c | |
parent | d477a9ab7e007cb31f51241861f9e434419b9621 (diff) | |
parent | c3ae047361c0412ed371ef899b018e9c13d6ecf8 (diff) | |
download | libgit2-a873449f1c1f5e803dae139d6d2145ffa94c1118.tar.gz |
Merge pull request #1753 from 13ren/log-bugfix
Fix -n bug; default to all ancestors
-rw-r--r-- | examples/log.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/log.c b/examples/log.c index dbbc42914..413c211e4 100644 --- a/examples/log.c +++ b/examples/log.c @@ -265,6 +265,7 @@ int main(int argc, char *argv[]) memset(&opt, 0, sizeof(opt)); opt.max_parents = -1; + opt.limit = -1; for (i = 1; i < argc; ++i) { a = argv[i]; @@ -294,8 +295,8 @@ int main(int argc, char *argv[]) if (!match_int(&opt.limit, a + 1, 0)) usage("Invalid limit on number of commits", a); } else if (!strcmp(a, "-n")) { - if (i + 1 == argc || !match_int(&opt.limit, argv[i], 0)) - usage("Argument -n not followed by valid count", argv[i]); + if (i + 1 == argc || !match_int(&opt.limit, argv[i + 1], 0)) + usage("Argument -n not followed by valid count", argv[i + 1]); else ++i; } @@ -363,7 +364,7 @@ int main(int argc, char *argv[]) if (count++ < opt.skip) continue; - if (printed++ >= opt.limit) { + if (opt.limit != -1 && printed++ >= opt.limit) { git_commit_free(commit); break; } |