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

2013-01-23 Thread Jens Lehmann
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[

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

2013-01-23 Thread Lars Hjemli
On Wed, Jan 23, 2013 at 6:04 PM, Junio C Hamano wrote: > Junio C Hamano writes: > >> But I still do not think this loop is correct. In a repository that >> has a working tree, you would learn that directory $D has $D/.git in >> it, feed $D to handle_repo(), and then descend into $D/.git/objects/

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

2013-01-23 Thread Lars Hjemli
On Wed, Jan 23, 2013 at 5:52 PM, Junio C Hamano wrote: > Lars Hjemli writes: > >> +static int walk(struct strbuf *path, int argc, const char **argv) >> +{ >> + DIR *dir; >> + struct dirent *ent; >> + struct stat st; >> + size_t len; >> + >> + dir = opendir(path->buf); >> +

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

2013-01-23 Thread Junio C Hamano
Junio C Hamano writes: > But I still do not think this loop is correct. In a repository that > has a working tree, you would learn that directory $D has $D/.git in > it, feed $D to handle_repo(), and then descend into $D/.git/objects/, > $D/.git/refs, and other random directories to see if you c

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

2013-01-23 Thread Junio C Hamano
Lars Hjemli writes: > +static int walk(struct strbuf *path, int argc, const char **argv) > +{ > + DIR *dir; > + struct dirent *ent; > + struct stat st; > + size_t len; > + > + dir = opendir(path->buf); > + if (!dir) > + return errno; > + strbuf_addstr(path,

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

2013-01-23 Thread Duy Nguyen
On Wed, Jan 23, 2013 at 4:24 PM, Lars Hjemli wrote: > On Wed, Jan 23, 2013 at 9:55 AM, Duy Nguyen wrote: >> 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? > > The `git all` command is regularly invoke

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

2013-01-23 Thread Lars Hjemli
On Wed, Jan 23, 2013 at 9:55 AM, Duy Nguyen wrote: > 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? The `git all` command is regularly invoked outside of git repos, so I'm not sure if this would work.

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

2013-01-23 Thread 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. Maybe "git-for-each-repo" > +static int get_repo_state() > +{ > + const char *diffidx[] = {"diff", "--quiet", "--cach

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

2013-01-23 Thread Lars Hjemli
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 ea