Download raw body.
Exclusive log end
After seeing log -x, I realized what I really wanted was an exclusive version of it. This allows for something like: $ got log -c featurebranch -X main -R -p to get a nice set of patches to send, instead of guessing the exact amount with -l. ok? ----------------------------------------------- commit c4eb443ea8ed5d1d18fb92667874d199bb506a94 (end_excl) from: Josh Rickmar <jrick@companyzero.com> date: Sun Mar 21 19:00:21 2021 UTC Add log -X (like -x but exclusive) diff c40cf9c87952e14a1ebf8751b147f2c2f30102bd 6555ead75fbb90c84f56dd3b7974f4c93826968f blob - 5b538ecd34e3cfd6ed3313e82c52125d334b4c3e blob + 02b4310c7da9f7c2b3ee431502346f29d6683fdb --- got/got.1 +++ got/got.1 @@ -717,7 +717,7 @@ in a pattern. .It Cm st Short alias for .Cm status . -.It Cm log Oo Fl b Oc Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl l Ar N Oc Oo Fl p Oc Oo Fl P Oc Oo Fl s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Oo Fl R Oc Oo Fl x Ar commit Oc Op Ar path +.It Cm log Oo Fl b Oc Oo Fl c Ar commit Oc Oo Fl C Ar number Oc Oo Fl l Ar N Oc Oo Fl p Oc Oo Fl P Oc Oo Fl s Ar search-pattern Oc Oo Fl r Ar repository-path Oc Oo Fl R Oc Oo Fl x Ar commit Oc Oo Fl X Ar commit Oc Op Ar path Display history of a repository. If a .Ar path @@ -798,6 +798,13 @@ has been traversed. This option has no effect if the specified .Ar commit is never traversed. +.It Fl X Ar commit +Stop traversing commit history immediately before the specified +.Ar commit +would be traversed. +This option has no effect if the specified +.Ar commit +is never encountered. .El .It Cm diff Oo Fl a Oc Oo Fl C Ar number Oc Oo Fl r Ar repository-path Oc Oo Fl s Oc Oo Fl w Oc Op Ar object1 Ar object2 | Ar path When invoked within a work tree with less than two arguments, display blob - 5a81fddc99d43b6d16f047c9a6ade37e0058f4e6 blob + 198b140e2513140cd1c932890abf85a78b1a9a69 --- got/got.c +++ got/got.c @@ -3691,13 +3691,13 @@ static const struct got_error * print_commits(struct got_object_id *root_id, struct got_object_id *end_id, struct got_repository *repo, const char *path, int show_changed_paths, int show_patch, const char *search_pattern, int diff_context, int limit, - int log_branches, int reverse_display_order, + int log_branches, int reverse_display_order, int end_excl, struct got_reflist_object_id_map *refs_idmap) { const struct got_error *err; struct got_commit_graph *graph; regex_t regex; - int have_match; + int have_match, at_end; struct got_object_id_queue reversed_commits; struct got_object_qid *qid; struct got_commit_object *commit; @@ -3764,6 +3764,10 @@ print_commits(struct got_object_id *root_id, struct go } } + at_end = end_id && got_object_id_cmp(id, end_id) == 0; + if (at_end && end_excl) + break; + if (reverse_display_order) { err = got_object_qid_alloc(&qid, id); if (err) @@ -3778,8 +3782,7 @@ print_commits(struct got_object_id *root_id, struct go if (err) break; } - if ((limit && --limit == 0) || - (end_id && got_object_id_cmp(id, end_id) == 0)) + if ((limit && --limit == 0) || at_end) break; TAILQ_FOREACH(pe, &changed_paths, entry) { @@ -3833,8 +3836,9 @@ __dead static void usage_log(void) { fprintf(stderr, "usage: %s log [-b] [-c commit] [-C number] [ -l N ] " - "[-p] [-P] [-x commit] [-s search-pattern] [-r repository-path] " - "[-R] [path]\n", getprogname()); + "[-p] [-P] [-x commit] [-X commit] [-s search-pattern] " + "[-r repository-path] [-R] [path]\n", getprogname()); + exit(1); } @@ -3866,7 +3870,7 @@ cmd_log(int argc, char *argv[]) const char *search_pattern = NULL; int diff_context = -1, ch; int show_changed_paths = 0, show_patch = 0, limit = 0, log_branches = 0; - int reverse_display_order = 0; + int reverse_display_order = 0, end_excl = 0; const char *errstr; struct got_reflist_head refs; struct got_reflist_object_id_map *refs_idmap = NULL; @@ -3882,7 +3886,7 @@ cmd_log(int argc, char *argv[]) limit = get_default_log_limit(); - while ((ch = getopt(argc, argv, "bpPc:C:l:r:Rs:x:")) != -1) { + while ((ch = getopt(argc, argv, "bpPc:C:l:r:Rs:x:X:")) != -1) { switch (ch) { case 'p': show_patch = 1; @@ -3922,7 +3926,12 @@ cmd_log(int argc, char *argv[]) break; case 'x': end_commit = optarg; + end_excl = 0; break; + case 'X': + end_commit = optarg; + end_excl = 1; + break; default: usage_log(); /* NOTREACHED */ @@ -4049,7 +4058,7 @@ cmd_log(int argc, char *argv[]) error = print_commits(start_id, end_id, repo, path ? path : "", show_changed_paths, show_patch, search_pattern, diff_context, - limit, log_branches, reverse_display_order, refs_idmap); + limit, log_branches, reverse_display_order, end_excl, refs_idmap); done: free(path); free(repo_path);
Exclusive log end