Re: [PATCH v8 1/1] repo: add filtering options to "repo structure"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 18, 2026, 22:28 UTC
- Message-ID
- <xmqq33sx3haz.fsf@gitster.g>
- In-Reply-To
- <20261118203519.2379494-2-markchucarroll@fastmail.com>
"Mark C. Chu-Carroll" <markchucarroll@fastmail.com> writes:
> The current implementation of "git repo stucture" provides summary > information about everything in the repository - all of the
...
> + argc = parse_options(argc, argv, prefix, options, repo_structure_usage, > + PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT);
Are we willing to lose "--" from the command line? For example, to count only the commits that touch things under the t/ directory between master and grobble:
git repo stucture master..grobble -- t/
might be useful, but without PARSE_OPT_KEEP_DASHDASH, wouldn't you lose "--"? If there are directories or files that happen to have the same name as an existing revision, the users would need to be able to disambiguate them with "--".
Show 7 quoted lines
> if (show_progress < 0)
> show_progress = isatty(2);
>
> + repo_init_revisions(repo, &revs, prefix);
> + if (argc > 1) {
> + argc = setup_revisions(argc, argv, &revs, NULL);
> + included_revision_args = true;Things like
git repo stucture --objects
git repo stucture --stdin
git repo stucture --end-of-optionswould still count as (argc > 1) and cause setup_revisions() to be called, but we still have not received any positive (or negative) revision to start traversing. Should not included_revision_args be initialized based on revs.rev_input_given or something?
> + if (argc > 1)
> + return error(_("unrecognized argument: %s"), argv[1]);This leaks revs and resources held by it because release_revisions() has not been called on it, which may not matter all that much as we will exit soon.
> + } > + > + structure_count_references(&stats.refs, &revs, repo, show_progress, !included_revision_args); > structure_count_objects(&stats.objects, &revs, repo, show_progress);