X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=rev-list.c;h=16920ef69e844697628ca3775403f86cc1c13945;hb=180926636e47ecfe28d03cec493af75899994f0f;hp=6e6a6dfecd72c4380f7248ff61fc607ffc1dbfc2;hpb=3d958064e0f26f3cbd5b201f295c182b6aa119da;p=git.git diff --git a/rev-list.c b/rev-list.c index 6e6a6dfe..16920ef6 100644 --- a/rev-list.c +++ b/rev-list.c @@ -5,6 +5,7 @@ #define SEEN (1u << 0) #define INTERESTING (1u << 1) #define COUNTED (1u << 2) +#define SHOWN (LAST_EPOCH_FLAG << 2) static const char rev_list_usage[] = "usage: git-rev-list [OPTION] commit-id \n" @@ -26,9 +27,11 @@ static int max_count = -1; static enum cmit_fmt commit_format = CMIT_FMT_RAW; static int merge_order = 0; static int show_breaks = 0; +static int stop_traversal = 0; static void show_commit(struct commit *commit) { + commit->object.flags |= SHOWN; if (show_breaks) { prefix = "| "; if (commit->object.flags & DISCONTINUITY) { @@ -55,15 +58,22 @@ static void show_commit(struct commit *commit) static int filter_commit(struct commit * commit) { - if (commit->object.flags & UNINTERESTING) + if (merge_order && stop_traversal && commit->object.flags & BOUNDARY) + return STOP; + if (commit->object.flags & (UNINTERESTING|SHOWN)) return CONTINUE; if (min_age != -1 && (commit->date > min_age)) return CONTINUE; - if (max_age != -1 && (commit->date < max_age)) - return STOP; + if (max_age != -1 && (commit->date < max_age)) { + if (!merge_order) + return STOP; + else { + stop_traversal = 1; + return CONTINUE; + } + } if (max_count != -1 && !max_count--) return STOP; - return DO; }