From: Derrick Stolee <stolee@gmail.com> To: Junio C Hamano <gitster@pobox.com>, Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com> Cc: git@vger.kernel.org, sandals@crustytoothpaste.net, steadmon@google.com, jrnieder@gmail.com, peff@peff.net, congdanhqx@gmail.com, phillip.wood123@gmail.com, emilyshaffer@google.com, sluongng@gmail.com, jonathantanmy@google.com, Derrick Stolee <derrickstolee@github.com>, Derrick Stolee <dstolee@microsoft.com> Subject: Re: [PATCH v2 4/7] for-each-repo: run subcommands on configured repos Date: Wed, 26 Aug 2020 12:03:21 -0400 [thread overview] Message-ID: <30cadb74-924e-09bc-1ca4-352de3e629f3@gmail.com> (raw) In-Reply-To: <xmqq8se2z7uh.fsf@gitster.c.googlers.com> On 8/25/2020 6:19 PM, Junio C Hamano wrote: > "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes: > >> +SYNOPSIS >> +-------- >> +[verse] >> +'git for-each-repo' --config=<config> [--] <arguments> >> + ... >> +--config=<config>:: >> + Use the given config variable as a multi-valued list storing >> + absolute path names. > > Would it make sense to allow this config to be read from the current > repository, I wonder. It is probably designed to be written to > either ~/.gitconfig or /etc/gitconfig because it is probably a need > that is not per-repository to list repositories for various purposes > specified by the config key, but I suspect there _might_ be a good > use case for storing some custom list of repositories in the > configuration file local to a repository, but it is not quite > obvious what it is. > > If we have a good example, we may want to spell it out---that would > help future readers who wonder about this (just like I am doing now). > > Also, if we do read from local config, should there be a way to say > "ah, you may have read values from /etc/gitconfig and ~/.gitconfig, > but please forget them---I have a full list I care when you are > running in this repository", i.e. clear the list. It is purely a > convention and there is no built-in mechanism for this in the config > API, but often it is signalled by giving an empty string as a value. I guess I should test this, but if I ask for a multi-valued config, will I not get _all_ of the results from /etc/gitconfig, ~/.gitconfig, AND .git/config? That was my expectation, which is why I don't specify "local" or "global" config anywhere in the discussion. > By the way, I do not have a good concrete suggestion, but can we use > something better than <config> as the placeholder? I first thought > this was naming the name of a file that lists repositories, not the > config variable name in our usual config namespace. Sure. How about "<key>"? >> +static int run_command_on_repo(const char *path, >> + void *cbdata) > > Is that on repo or in repo? When I saw "-C" on the command line, I > immediately thought of "in repo". "in" is better. >> +{ >> + int i; >> + struct child_process child = CHILD_PROCESS_INIT; >> + struct strvec *args = (struct strvec *)cbdata; >> + >> + child.git_cmd = 1; >> + strvec_pushl(&child.args, "-C", path, NULL); >> + >> + for (i = 0; i < args->nr; i++) >> + strvec_push(&child.args, args->v[i]); > > Would strvec_pushv() work, or is args->v[] not NULL terminated? Yeah, pushv should work. >> + return run_command(&child); >> +} > > >> + values = repo_config_get_value_multi(the_repository, >> + config_key); > > Not your fault, but it is a bit unsatisfactory that we do not have > special "type" meant for paths in the config API, unlike the > parse-options API where there is a "filename" type that is a bit > richer than a vanilla "string" type by allowing "prefix" handling. > For the purposes of this, as the values are limited to absolute/full > pathnames, it does not hurt as much, though. Interesting. Noted. Thanks, -Stolee
next prev parent reply other threads:[~2020-08-26 16:03 UTC|newest] Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-19 17:16 [PATCH 0/7] [RFC] Maintenance III: background maintenance Derrick Stolee via GitGitGadget 2020-08-19 17:16 ` [PATCH 1/7] maintenance: optionally skip --auto process Derrick Stolee via GitGitGadget 2020-08-20 2:06 ` Đoàn Trần Công Danh 2020-08-20 12:12 ` Derrick Stolee 2020-08-19 17:16 ` [PATCH 3/7] maintenance: add --scheduled option and config Derrick Stolee via GitGitGadget 2020-08-20 14:51 ` Đoàn Trần Công Danh 2020-08-24 14:03 ` Derrick Stolee 2020-08-19 17:16 ` [PATCH 4/7] for-each-repo: run subcommands on configured repos Derrick Stolee via GitGitGadget 2020-08-20 15:00 ` Đoàn Trần Công Danh 2020-08-19 17:16 ` [PATCH 5/7] maintenance: add [un]register subcommands Derrick Stolee via GitGitGadget 2020-08-19 17:16 ` [PATCH 6/7] maintenance: add start/stop subcommands Derrick Stolee via GitGitGadget 2020-08-19 17:16 ` [PATCH 7/7] maintenance: recommended schedule in register/start Derrick Stolee via GitGitGadget [not found] ` <bdc27fa28ee70222ed3c7c9863746ace8ea835e4.1597857409.git.gitgitgadget@gmail.com> 2020-08-20 14:34 ` [PATCH 2/7] maintenance: store the "last run" time in config Đoàn Trần Công Danh 2020-08-25 18:39 ` [PATCH v2 0/7] [RFC] Maintenance III: background maintenance Derrick Stolee via GitGitGadget 2020-08-25 18:39 ` [PATCH v2 1/7] maintenance: optionally skip --auto process Derrick Stolee via GitGitGadget 2020-08-25 21:44 ` Junio C Hamano 2020-08-26 12:29 ` Derrick Stolee 2020-08-26 16:57 ` Junio C Hamano 2020-08-25 18:39 ` [PATCH v2 2/7] maintenance: store the "last run" time in config Derrick Stolee via GitGitGadget 2020-08-25 21:52 ` Junio C Hamano 2020-08-26 13:34 ` Derrick Stolee 2020-08-26 17:03 ` Junio C Hamano 2020-08-27 13:02 ` Derrick Stolee 2020-08-25 18:40 ` [PATCH v2 3/7] maintenance: add --scheduled option and config Derrick Stolee via GitGitGadget 2020-08-25 22:01 ` Junio C Hamano 2020-08-26 15:30 ` Derrick Stolee 2020-08-27 15:47 ` Derrick Stolee 2020-08-25 18:40 ` [PATCH v2 4/7] for-each-repo: run subcommands on configured repos Derrick Stolee via GitGitGadget 2020-08-25 22:19 ` Junio C Hamano 2020-08-26 16:03 ` Derrick Stolee [this message] 2020-08-25 18:40 ` [PATCH v2 5/7] maintenance: add [un]register subcommands Derrick Stolee via GitGitGadget 2020-08-25 18:40 ` [PATCH v2 6/7] maintenance: add start/stop subcommands Derrick Stolee via GitGitGadget 2020-08-25 18:40 ` [PATCH v2 7/7] maintenance: recommended schedule in register/start Derrick Stolee via GitGitGadget 2020-08-28 15:45 ` [PATCH v3 0/6] [RFC] Maintenance III: background maintenance Derrick Stolee via GitGitGadget 2020-08-28 15:45 ` [PATCH v3 1/6] maintenance: optionally skip --auto process Derrick Stolee via GitGitGadget 2020-08-28 15:45 ` [PATCH v3 2/6] maintenance: add --schedule option and config Derrick Stolee via GitGitGadget 2020-08-28 15:45 ` [PATCH v3 3/6] for-each-repo: run subcommands on configured repos Derrick Stolee via GitGitGadget 2020-08-28 15:45 ` [PATCH v3 4/6] maintenance: add [un]register subcommands Derrick Stolee via GitGitGadget 2020-08-28 15:45 ` [PATCH v3 5/6] maintenance: add start/stop subcommands Derrick Stolee via GitGitGadget 2020-08-28 15:45 ` [PATCH v3 6/6] maintenance: recommended schedule in register/start Derrick Stolee via GitGitGadget 2020-08-26 12:42 ` [PATCH 0/7] [RFC] Maintenance III: background maintenance Michal Suchánek
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=30cadb74-924e-09bc-1ca4-352de3e629f3@gmail.com \ --to=stolee@gmail.com \ --cc=congdanhqx@gmail.com \ --cc=derrickstolee@github.com \ --cc=dstolee@microsoft.com \ --cc=emilyshaffer@google.com \ --cc=git@vger.kernel.org \ --cc=gitgitgadget@gmail.com \ --cc=gitster@pobox.com \ --cc=jonathantanmy@google.com \ --cc=jrnieder@gmail.com \ --cc=peff@peff.net \ --cc=phillip.wood123@gmail.com \ --cc=sandals@crustytoothpaste.net \ --cc=sluongng@gmail.com \ --cc=steadmon@google.com \ --subject='Re: [PATCH v2 4/7] for-each-repo: run subcommands on configured repos' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).