Git fork

revision: put object filter into struct rev_info

Placing a 'struct list_objects_filter_options' within 'struct rev_info'
will assist making some bookkeeping around object filters in the future.

For now, let's use this new member to remove a static global instance of
the struct from builtin/rev-list.c.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Derrick Stolee and committed by
Junio C Hamano
ffaa137f 4a4c3f9b

+19 -14
+12 -14
builtin/rev-list.c
··· 62 62 static struct progress *progress; 63 63 static unsigned progress_counter; 64 64 65 - static struct list_objects_filter_options filter_options; 66 65 static struct oidset omitted_objects; 67 66 static int arg_print_omitted; /* print objects omitted by filter */ 68 67 ··· 400 399 } 401 400 402 401 static int try_bitmap_count(struct rev_info *revs, 403 - struct list_objects_filter_options *filter, 404 402 int filter_provided_objects) 405 403 { 406 404 uint32_t commit_count = 0, ··· 436 434 */ 437 435 max_count = revs->max_count; 438 436 439 - bitmap_git = prepare_bitmap_walk(revs, filter, filter_provided_objects); 437 + bitmap_git = prepare_bitmap_walk(revs, &revs->filter, 438 + filter_provided_objects); 440 439 if (!bitmap_git) 441 440 return -1; 442 441 ··· 453 452 } 454 453 455 454 static int try_bitmap_traversal(struct rev_info *revs, 456 - struct list_objects_filter_options *filter, 457 455 int filter_provided_objects) 458 456 { 459 457 struct bitmap_index *bitmap_git; ··· 465 463 if (revs->max_count >= 0) 466 464 return -1; 467 465 468 - bitmap_git = prepare_bitmap_walk(revs, filter, filter_provided_objects); 466 + bitmap_git = prepare_bitmap_walk(revs, &revs->filter, 467 + filter_provided_objects); 469 468 if (!bitmap_git) 470 469 return -1; 471 470 ··· 475 474 } 476 475 477 476 static int try_bitmap_disk_usage(struct rev_info *revs, 478 - struct list_objects_filter_options *filter, 479 477 int filter_provided_objects) 480 478 { 481 479 struct bitmap_index *bitmap_git; ··· 483 481 if (!show_disk_usage) 484 482 return -1; 485 483 486 - bitmap_git = prepare_bitmap_walk(revs, filter, filter_provided_objects); 484 + bitmap_git = prepare_bitmap_walk(revs, &revs->filter, filter_provided_objects); 487 485 if (!bitmap_git) 488 486 return -1; 489 487 ··· 597 595 } 598 596 599 597 if (skip_prefix(arg, ("--" CL_ARG__FILTER "="), &arg)) { 600 - parse_list_objects_filter(&filter_options, arg); 601 - if (filter_options.choice && !revs.blob_objects) 598 + parse_list_objects_filter(&revs.filter, arg); 599 + if (revs.filter.choice && !revs.blob_objects) 602 600 die(_("object filtering requires --objects")); 603 601 continue; 604 602 } 605 603 if (!strcmp(arg, ("--no-" CL_ARG__FILTER))) { 606 - list_objects_filter_set_no_filter(&filter_options); 604 + list_objects_filter_set_no_filter(&revs.filter); 607 605 continue; 608 606 } 609 607 if (!strcmp(arg, "--filter-provided-objects")) { ··· 688 686 progress = start_delayed_progress(show_progress, 0); 689 687 690 688 if (use_bitmap_index) { 691 - if (!try_bitmap_count(&revs, &filter_options, filter_provided_objects)) 689 + if (!try_bitmap_count(&revs, filter_provided_objects)) 692 690 return 0; 693 - if (!try_bitmap_disk_usage(&revs, &filter_options, filter_provided_objects)) 691 + if (!try_bitmap_disk_usage(&revs, filter_provided_objects)) 694 692 return 0; 695 - if (!try_bitmap_traversal(&revs, &filter_options, filter_provided_objects)) 693 + if (!try_bitmap_traversal(&revs, filter_provided_objects)) 696 694 return 0; 697 695 } 698 696 ··· 733 731 oidset_init(&missing_objects, DEFAULT_OIDSET_SIZE); 734 732 735 733 traverse_commit_list_filtered( 736 - &filter_options, &revs, show_commit, show_object, &info, 734 + &revs.filter, &revs, show_commit, show_object, &info, 737 735 (arg_print_omitted ? &omitted_objects : NULL)); 738 736 739 737 if (arg_print_omitted) {
+7
revision.h
··· 8 8 #include "pretty.h" 9 9 #include "diff.h" 10 10 #include "commit-slab-decl.h" 11 + #include "list-objects-filter-options.h" 11 12 12 13 /** 13 14 * The revision walking API offers functions to build a list of revisions ··· 93 94 94 95 /* The end-points specified by the end user */ 95 96 struct rev_cmdline_info cmdline; 97 + 98 + /* 99 + * Object filter options. No filtering is specified 100 + * if and only if filter.choice is zero. 101 + */ 102 + struct list_objects_filter_options filter; 96 103 97 104 /* excluding from --branches, --refs, etc. expansion */ 98 105 struct string_list *ref_excludes;