git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Shourya Shukla <shouryashukla.oo@gmail.com>
To: gitgitgadget@gmail.com
Cc: git@vger.kernel.org, guillaume.galeazzi@gmail.com
Subject: Re: [PATCH] submodule--helper.c: add only-active to foreach
Date: Sun, 10 May 2020 22:14:24 +0530	[thread overview]
Message-ID: <20200510164424.GA11784@konoha> (raw)
In-Reply-To: <pull.631.git.1589099162707.gitgitgadget@gmail.com>

Hey Guillaume,

> On repository with some submodule not active, it could be needed to run
> a command only for active submodule. Today it can be achived with the
> command:

Spelling: achive -> achieve

Maybe we can keep the commit message a bit more imperative?
Something like:
-------------------------
On a repository with some submodules not active, one may need to run a
command only for an active submodule or vice-versa. To achieve this,
one may use:
git submodule foreach 'git -C $toplevel submodule--helper is-active \
$sm_path && pwd || :'

Simplify this expression to make it more readable and easy-to-use by
adding the flag `--is-active` to subcommand `foreach` of `git
submodule`. Thus, simplifying the above command to:
git submodule--helper foreach --is-active pwd
-------------------------
Yes, maybe renaming the flag to `--is-active` would make it a tad bit
simpler? This commit message may not be perfect but it seems like an
improvement over the previous one?

To me this option seems good. It may have some good utility in the
future. Similarly, we may change the struct to:
	struct foreach_cb {
 	const char *prefix;
 	int quiet;
 	int recursive;
	int is_active;
	 };

Therefore, the if-statement becomes:
	if (info->is_active && !is_submodule_active(the_repository, path))
		return;

BTW what do we return here, could you please be more specific?
Again, the change here as well:
		OPT_BOOL(0, "is-active", &info.is_active,

Here, too:
		N_("git submodule--helper foreach [--quiet] [--recursive] [--is-active] [--] <command>"),

And,
	test_expect_success 'test "submodule--helper foreach --is-active" usage' '

Finally,
	git submodule--helper foreach --is-active "echo \$toplevel-\$name-\$path-\$sha1" > ../actual

What do you think?

Regards,
Shourya Shukla

  reply	other threads:[~2020-05-10 16:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-10  8:26 [PATCH] submodule--helper.c: add only-active to foreach Guillaume G. via GitGitGadget
2020-05-10 16:44 ` Shourya Shukla [this message]
2020-05-10 21:51   ` Guillaume Galeazzi
2020-05-10 22:42     ` Eric Sunshine
2020-05-15 16:29       ` Guillaume Galeazzi
2020-05-12 14:15     ` Shourya Shukla
2020-05-15 16:51       ` Guillaume Galeazzi
2020-05-15 17:03         ` Junio C Hamano
2020-05-15 18:53           ` Guillaume Galeazzi
2020-05-12 18:53 ` Junio C Hamano
2020-05-13  5:17   ` Guillaume Galeazzi
2020-05-13 15:35     ` Junio C Hamano
2020-05-13 20:07       ` Guillaume Galeazzi
2020-05-13 20:35         ` Junio C Hamano
2020-05-15 11:04           ` Guillaume Galeazzi
2020-05-17  6:30 ` [PATCH v2 0/3] " Guillaume G. via GitGitGadget
2020-05-17  6:30   ` [PATCH v2 1/3] submodule--helper.c: add active " Guillaume Galeazzi via GitGitGadget
2020-05-17  6:30   ` [PATCH v2 2/3] submodule--helper.c: add populated " Guillaume Galeazzi via GitGitGadget
2020-05-17  6:30   ` [PATCH v2 3/3] submodule--helper.c: add branch " Guillaume Galeazzi via GitGitGadget
2020-05-17 15:46   ` [PATCH v2 0/3] submodule--helper.c: add only-active " Junio C Hamano
2020-05-17 19:47     ` Guillaume Galeazzi
2020-08-18 15:57     ` Guillaume Galeazzi

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=20200510164424.GA11784@konoha \
    --to=shouryashukla.oo@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=guillaume.galeazzi@gmail.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).