@matheusbsbs / matheus-bagliano / commits / 37c4c38d73
Fork 0

rev-list: pass "int flags" as last argument of "show_bisect_vars"

Instead of "int show_all, int show_tried" we now only pass "int flags", because we will add one more flag in a later patch. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Mar 29, 2009 at 11:55 UTC 37c4c38d7356bf256d0297fdbac78ef8b6807fac
3 files changed +13 -10
bisect.c
+1 -1
@@ -547,5 +547,5 @@ int bisect_next_vars(const char *prefix)
547 revs.commits = find_bisection(revs.commits, &reaches, &all,
548 !!skipped_sha1_nr);
549
550 - return show_bisect_vars(&revs, reaches, all, 0, 1);
550 + return show_bisect_vars(&revs, reaches, all, BISECT_SHOW_TRIED);
551 }
bisect.h
+6 -2
@@ -9,13 +9,17 @@ extern struct commit_list *filter_skipped(struct commit_list *list,
9 struct commit_list **tried,
10 int show_all);
11
12 +/* show_bisect_vars flags */
13 +#define BISECT_SHOW_ALL (1<<0)
14 +#define BISECT_SHOW_TRIED (1<<1)
15 +
16 /*
13 - * The "show_all" parameter should be 0 if this function is called
17 + * The flag BISECT_SHOW_ALL should not be set if this function is called
18 * from outside "builtin-rev-list.c" as otherwise it would use
19 * static "revs" from this file.
20 */
21 extern int show_bisect_vars(struct rev_info *revs, int reaches, int all,
18 - int show_all, int show_tried);
22 + int flags);
23
24 extern int bisect_next_vars(const char *prefix);
25
builtin-rev-list.c
+6 -7
@@ -236,17 +236,16 @@ static void show_tried_revs(struct commit_list *tried)
236 printf("'\n");
237 }
238
239 -int show_bisect_vars(struct rev_info *revs, int reaches, int all,
240 - int show_all, int show_tried)
239 +int show_bisect_vars(struct rev_info *revs, int reaches, int all, int flags)
240 {
241 int cnt;
242 char hex[41] = "";
243 struct commit_list *tried;
244
246 - if (!revs->commits && !show_tried)
245 + if (!revs->commits && !(flags & BISECT_SHOW_TRIED))
246 return 1;
247
249 - revs->commits = filter_skipped(revs->commits, &tried, show_all);
248 + revs->commits = filter_skipped(revs->commits, &tried, flags & BISECT_SHOW_ALL);
249
250 /*
251 * revs->commits can reach "reaches" commits among
@@ -264,12 +263,12 @@ int show_bisect_vars(struct rev_info *revs, int reaches, int all,
263 if (revs->commits)
264 strcpy(hex, sha1_to_hex(revs->commits->item->object.sha1));
265
267 - if (show_all) {
266 + if (flags & BISECT_SHOW_ALL) {
267 traverse_commit_list(revs, show_commit, show_object);
268 printf("------\n");
269 }
270
272 - if (show_tried)
271 + if (flags & BISECT_SHOW_TRIED)
272 show_tried_revs(tried);
273 printf("bisect_rev=%s\n"
274 "bisect_nr=%d\n"
@@ -379,7 +378,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
378
379 if (bisect_show_vars)
380 return show_bisect_vars(&revs, reaches, all,
382 - bisect_show_all, 0);
381 + bisect_show_all ? BISECT_SHOW_ALL : 0);
382 }
383
384 traverse_commit_list(&revs,