Re: [PATCH v4 1/2] for-each-repo: new command used for multi-repo operations
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:55:55
John Keeping [off-list ref] writes:
On Sun, Jan 27, 2013 at 11:04:08AM -0800, Junio C Hamano wrote:quoted
One more thing that nobody brought up during the previous reviews is if we want to support subset of repositories by allowing the standard pathspec match mechanism. For example, git for-each-repo -d git diff --name-only -- foo/ bar/b\*z might be a way to ask "please find repositories match the given pathspecs (i.e. foo/ bar/b\*z) and run the command in the ones that are dirty". We would need to think about how to mark the end of the command though---we could borrow \; from find(1), even though find is not the best example of the UI design. I.e. git for-each-repo -d git diff --name-only \; [--] foo/ bar/b\*z with or without "--".Would it be better to make this a (multi-valued) option? git for-each-repo -d --filter=foo/ --filter=bar/b\*z git diff --name-only
The standard way to use filtering based on paths we have is to use the pathspec parameters at the end of the commmand line. I see no reason for such an inconsistency with an option like --filter.
quoted
Oh, that reminds me of another thing. Perhaps we would want to export the (relative) path to the found repository in some way to allow the commands to do this kind of thing in the first place? "submodule foreach" does this with $path, I think.I think $path is the only variable exported by "submodule foreach" which is applicable here, but it doesn't work on Windows, where environment variables are case-insensitive. Commit 64394e3 (git-submodule.sh: Don't use $path variable in eval_gettext string) changed "submodule foreach" to use $sm_path internally although I notice that the documentation still uses $path. Perhaps $repo_path in this case?
I do not care too deeply about the name, as long as the names used by both mechanisms are the same.