git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] all: new command used for multi-repo operations

From
Duy Nguyen <pclouds@gmail.com>
Date
Jan 23, 2013, 08:39 UTC
Message-ID
<CACsJy8CTJ--u+KCYmK-2+K3NpEn72xnYwh_Pb+3Wn7nEtL1gqQ@mail.gmail.com>
In-Reply-To
<1358889019-4554-1-git-send-email-hjemli@gmail.com>
On Wed, Jan 23, 2013 at 4:10 AM, Lars Hjemli <hjemli@gmail.com> wrote:
Show 11 quoted lines
> When working with multiple, unrelated (or loosly related) git repos,
> there is often a need to locate all repos with uncommitted work and
> perform some action on them (say, commit and push). Before this patch,
> such tasks would require manually visiting all repositories, running
> `git status` within each one and then decide what to do next.
>
> This mundane task can now be automated by e.g. `git all --dirty status`,
> which will find all git repositories below the current directory (even
> nested ones), check if they are dirty (as defined by `git diff --quiet &&
> git diff --cached --quiet`), and for each dirty repo print the path to the
> repo and then execute `git status` within the repo.

I think it should leave out the execute part. The command, say ls-repo, lists repositories in specified state. The execute part could be easily done by

xargs -I{} git --git-dir={} status blah

I haven't thought it through. I know xargs does not support chdir'ing into a repo, so maybe a new git-xargs could be introduced for that. But there's still a problem with git-xargs (or git-all), printed paths are relative to the subrepos, not where the git-all/xargs command is executed. This could be confusing. Personally I'd like to do it without chdir. That is

xargs -I{} git --git-dir={}/.git --work-tree={} status blah

should print paths relative to current working directory even if cwd is outside the repo.

-- 
Duy
Previous: Junio C HamanoNext: Lars Hjemli
Message 9 of 11 in “all: new command used for multi-repo operations”
  1. all: new command used for multi-repo operationsLars Hjemli, Jan 22, 2013
  2. Junio C HamanoJan 22, 2013
  3. Lars HjemliJan 22, 2013
  4. Junio C HamanoJan 23, 2013
  5. David AguilarJan 23, 2013
  6. Junio C HamanoJan 23, 2013
  7. Lars HjemliJan 23, 2013
  8. Junio C HamanoJan 23, 2013
  9. Duy NguyenJan 23, 2013
  10. Lars HjemliJan 23, 2013
  11. all: new command used for multi-repo operationsLars Hjemli, Jan 23, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.