Skip to content

Commit 0f559f5

Browse files
committed
Merge branch 'nd/maint-verify-objects'
* nd/maint-verify-objects: rev-list: fix --verify-objects --quiet becoming --objects rev-list: remove BISECT_SHOW_TRIED flag
2 parents 6a3a3db + 9899372 commit 0f559f5

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

bisect.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ extern void print_commit_list(struct commit_list *list,
1515
const char *format_cur,
1616
const char *format_last);
1717

18-
/* bisect_show_flags flags in struct rev_list_info */
1918
#define BISECT_SHOW_ALL (1<<0)
20-
#define BISECT_SHOW_TRIED (1<<1)
19+
#define REV_LIST_QUIET (1<<1)
2120

2221
struct rev_list_info {
2322
struct rev_info *revs;
24-
int bisect_show_flags;
23+
int flags;
2524
int show_timestamp;
2625
int hdr_termination;
2726
const char *header_prefix;

builtin/rev-list.c

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ static void show_commit(struct commit *commit, void *data)
5252
struct rev_list_info *info = data;
5353
struct rev_info *revs = info->revs;
5454

55+
if (info->flags & REV_LIST_QUIET) {
56+
finish_commit(commit, data);
57+
return;
58+
}
59+
5560
graph_show_commit(revs->graph);
5661

5762
if (revs->count) {
@@ -172,19 +177,21 @@ static void finish_object(struct object *obj,
172177
const struct name_path *path, const char *name,
173178
void *cb_data)
174179
{
180+
struct rev_list_info *info = cb_data;
175181
if (obj->type == OBJ_BLOB && !has_sha1_file(obj->sha1))
176182
die("missing blob object '%s'", sha1_to_hex(obj->sha1));
183+
if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
184+
parse_object(obj->sha1);
177185
}
178186

179187
static void show_object(struct object *obj,
180188
const struct name_path *path, const char *component,
181189
void *cb_data)
182190
{
183191
struct rev_list_info *info = cb_data;
184-
185192
finish_object(obj, path, component, cb_data);
186-
if (info->revs->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
187-
parse_object(obj->sha1);
193+
if (info->flags & REV_LIST_QUIET)
194+
return;
188195
show_object_with_name(stdout, obj, path, component);
189196
}
190197

@@ -242,13 +249,6 @@ void print_commit_list(struct commit_list *list,
242249
}
243250
}
244251

245-
static void show_tried_revs(struct commit_list *tried)
246-
{
247-
printf("bisect_tried='");
248-
print_commit_list(tried, "%s|", "%s");
249-
printf("'\n");
250-
}
251-
252252
static void print_var_str(const char *var, const char *val)
253253
{
254254
printf("%s='%s'\n", var, val);
@@ -261,12 +261,12 @@ static void print_var_int(const char *var, int val)
261261

262262
static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
263263
{
264-
int cnt, flags = info->bisect_show_flags;
264+
int cnt, flags = info->flags;
265265
char hex[41] = "";
266266
struct commit_list *tried;
267267
struct rev_info *revs = info->revs;
268268

269-
if (!revs->commits && !(flags & BISECT_SHOW_TRIED))
269+
if (!revs->commits)
270270
return 1;
271271

272272
revs->commits = filter_skipped(revs->commits, &tried,
@@ -294,9 +294,6 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
294294
printf("------\n");
295295
}
296296

297-
if (flags & BISECT_SHOW_TRIED)
298-
show_tried_revs(tried);
299-
300297
print_var_str("bisect_rev", hex);
301298
print_var_int("bisect_nr", cnt - 1);
302299
print_var_int("bisect_good", all - reaches - 1);
@@ -315,7 +312,6 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
315312
int bisect_list = 0;
316313
int bisect_show_vars = 0;
317314
int bisect_find_all = 0;
318-
int quiet = 0;
319315

320316
git_config(git_default_config, NULL);
321317
init_revisions(&revs, prefix);
@@ -328,7 +324,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
328324
if (revs.bisect)
329325
bisect_list = 1;
330326

331-
quiet = DIFF_OPT_TST(&revs.diffopt, QUICK);
327+
if (DIFF_OPT_TST(&revs.diffopt, QUICK))
328+
info.flags |= REV_LIST_QUIET;
332329
for (i = 1 ; i < argc; i++) {
333330
const char *arg = argv[i];
334331

@@ -347,7 +344,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
347344
if (!strcmp(arg, "--bisect-all")) {
348345
bisect_list = 1;
349346
bisect_find_all = 1;
350-
info.bisect_show_flags = BISECT_SHOW_ALL;
347+
info.flags |= BISECT_SHOW_ALL;
351348
revs.show_decorations = 1;
352349
continue;
353350
}
@@ -398,10 +395,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
398395
return show_bisect_vars(&info, reaches, all);
399396
}
400397

401-
traverse_commit_list(&revs,
402-
quiet ? finish_commit : show_commit,
403-
quiet ? finish_object : show_object,
404-
&info);
398+
traverse_commit_list(&revs, show_commit, show_object, &info);
405399

406400
if (revs.count) {
407401
if (revs.left_right && revs.cherry_mark)

0 commit comments

Comments
 (0)