diff mbox series

[1/2] for-each-repo: interpolate repo path arguments

Message ID 20221105184532.457043-2-ronan@rjp.ie (mailing list archive)
State Superseded
Headers show
Series git-maintenance quality-of-life improvements | expand

Commit Message

Ronan Pigott Nov. 5, 2022, 6:45 p.m. UTC
This is a quality of life change for git-maintenance, so repos can be
recorded with the tilde syntax. The register subcommand will not record
repos in this format by default.

Signed-off-by: Ronan Pigott <ronan@rjp.ie>
---
 builtin/for-each-repo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Taylor Blau Nov. 6, 2022, 12:30 a.m. UTC | #1
On Sat, Nov 05, 2022 at 11:45:31AM -0700, Ronan Pigott wrote:
> This is a quality of life change for git-maintenance, so repos can be
> recorded with the tilde syntax. The register subcommand will not record
> repos in this format by default.
>
> Signed-off-by: Ronan Pigott <ronan@rjp.ie>
> ---
>  builtin/for-each-repo.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Seems reasonable. So the 'register' subcommand will never write a record
that isn't an absolute path, but a user may manually munge the
maintenance configuration and we want to err on the side of flexibility.

OK, sounds good. Missing test, though?

Thanks,
Taylor
Derrick Stolee Nov. 7, 2022, 8:46 p.m. UTC | #2
On 11/5/22 8:30 PM, Taylor Blau wrote:
> On Sat, Nov 05, 2022 at 11:45:31AM -0700, Ronan Pigott wrote:
>> This is a quality of life change for git-maintenance, so repos can be
>> recorded with the tilde syntax. The register subcommand will not record
>> repos in this format by default.
>>
>> Signed-off-by: Ronan Pigott <ronan@rjp.ie>
>> ---
>>  builtin/for-each-repo.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> Seems reasonable. So the 'register' subcommand will never write a record
> that isn't an absolute path, but a user may manually munge the
> maintenance configuration and we want to err on the side of flexibility.
> 
> OK, sounds good. Missing test, though?

I agree that this implementation looks good, but a test
would be helpful to be sure.

Thanks,
-Stolee
diff mbox series

Patch

diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c
index d45d873f57..6aeac37148 100644
--- a/builtin/for-each-repo.c
+++ b/builtin/for-each-repo.c
@@ -14,13 +14,16 @@  static int run_command_on_repo(const char *path, int argc, const char ** argv)
 {
 	int i;
 	struct child_process child = CHILD_PROCESS_INIT;
+	char *abspath = interpolate_path(path, 0);
 
 	child.git_cmd = 1;
-	strvec_pushl(&child.args, "-C", path, NULL);
+	strvec_pushl(&child.args, "-C", abspath, NULL);
 
 	for (i = 0; i < argc; i++)
 		strvec_push(&child.args, argv[i]);
 
+	free(abspath);
+
 	return run_command(&child);
 }