From: Ronan Pigott <ronan@rjp.ie>
To: git@vger.kernel.org
Cc: me@ttaylor.com, derrickstolee@github.com
Subject: [PATCH v2 1/2] for-each-repo: interpolate repo path arguments
Date: Tue, 8 Nov 2022 12:49:29 -0700 [thread overview]
Message-ID: <20221108194930.25805-2-ronan@rjp.ie> (raw)
In-Reply-To: <20221108194930.25805-1-ronan@rjp.ie>
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 ++++-
t/t0068-for-each-repo.sh | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
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);
}
diff --git a/t/t0068-for-each-repo.sh b/t/t0068-for-each-repo.sh
index 4675e85251..c6e0d65563 100755
--- a/t/t0068-for-each-repo.sh
+++ b/t/t0068-for-each-repo.sh
@@ -8,9 +8,11 @@ test_expect_success 'run based on configured value' '
git init one &&
git init two &&
git init three &&
+ git init ~/four &&
git -C two commit --allow-empty -m "DID NOT RUN" &&
git config run.key "$TRASH_DIRECTORY/one" &&
git config --add run.key "$TRASH_DIRECTORY/three" &&
+ git config --add run.key "~/four" &&
git for-each-repo --config=run.key commit --allow-empty -m "ran" &&
git -C one log -1 --pretty=format:%s >message &&
grep ran message &&
@@ -18,12 +20,16 @@ test_expect_success 'run based on configured value' '
! grep ran message &&
git -C three log -1 --pretty=format:%s >message &&
grep ran message &&
+ git -C ~/four log -1 --pretty=format:%s >message &&
+ grep ran message &&
git for-each-repo --config=run.key -- commit --allow-empty -m "ran again" &&
git -C one log -1 --pretty=format:%s >message &&
grep again message &&
git -C two log -1 --pretty=format:%s >message &&
! grep again message &&
git -C three log -1 --pretty=format:%s >message &&
+ grep again message &&
+ git -C ~/four log -1 --pretty=format:%s >message &&
grep again message
'
--
2.38.1
next prev parent reply other threads:[~2022-11-08 19:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 19:49 [PATCH v2 0/2] git-maintenance quality-of-life improvements Ronan Pigott
2022-11-08 19:49 ` Ronan Pigott [this message]
2022-11-08 19:49 ` [PATCH v2 2/2] maintenance: add option to register in a specific config Ronan Pigott
2022-11-08 20:38 ` Phillip Wood
2022-11-08 20:57 ` Taylor Blau
2022-11-08 21:28 ` Phillip Wood
2022-11-08 22:45 ` ronan
2022-11-09 15:05 ` Derrick Stolee
2022-11-10 2:38 ` Taylor Blau
2022-11-08 19:54 ` [PATCH v2 0/2] git-maintenance quality-of-life improvements Taylor Blau
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221108194930.25805-2-ronan@rjp.ie \
--to=ronan@rjp.ie \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylor.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).