From: Jens Lehmann Date: Wed, 23 Jan 2013 20:17:06 GMT Subject: Re: [PATCH v2] all: new command used for multi-repo operations Message-ID: <51004542.8010708@web.de> In-Reply-To: Am 23.01.2013 09:55, schrieb Duy Nguyen: > On Wed, Jan 23, 2013 at 3:12 PM, Lars Hjemli wrote: >> +NAME >> +---- >> +git-all - Execute a git command in multiple repositories > > I agree with Junio "git-all" is too generic. +1 >> +static int get_repo_state() >> +{ >> + const char *diffidx[] = {"diff", "--quiet", "--cached", NULL}; >> + const char *diffwd[] = {"diff", "--quiet", NULL}; >> + >> + if (run_command_v_opt(diffidx, RUN_GIT_CMD) != 0) >> + return DIRTY; >> + if (run_command_v_opt(diffwd, RUN_GIT_CMD) != 0) >> + return DIRTY; >> + return CLEAN; >> +} > > Perhaps we could add the subrepo's object data to the in-memory object > database of git-all, then do the diff without launching new commands? You could do that for the "--cached" case, but not for the plain diff. But I think forking a "git status --porcelain -uno" and testing if it produced any output should do the trick with a single fork.