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

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

From
LHLars Hjemli <hjemli@gmail.com>
Date
Jan 23, 2013, 08:52 UTC
Message-ID
<CAFXTnz5pG8ifPvMp8xin3xSikGT9iLoUfsrqpepxDDTCMZ2wRQ@mail.gmail.com>
In-Reply-To
<CAFXTnz51czE5iS_pgZyU7SdUwrmZcmLxjFGpCGVhLGJFvW=HRQ@mail.gmail.com>
[*git@vger.kernel.org accidentally dropped from cc *]
On Wed, Jan 23, 2013 at 7:52 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> Lars Hjemli <hjemli@gmail.com> writes:
>
>> +static int walk(struct strbuf *path, int argc, const char **argv)
>> +{
>> +     DIR *dir;
>> +     struct dirent *ent;
>> +     size_t len;
>> +
>> +     dir = opendir(path->buf);
>> +     if (!dir)
>> +             return errno;
>> +     strbuf_addstr(path, "/");
>> +     len = path->len;
>> +     while ((ent = readdir(dir))) {
>> +             if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
>> +                     continue;
>> +             if (!strcmp(ent->d_name, ".git")) {
>
> This only looks for the top of working tree.  Have you considered if
> this "iterate over directories and list git repositories in them"
> may be useful for collection of bare repositories, and if it is, how
> to go about implementing the discovery process?

Yes, occasionally I've needed this, but implementing it in my original shell script was cumbersome. Doing it in C should be as simple as invoking is_git_directory() on each subdir.

Show 11 quoted lines
>
>> +             if (ent->d_type != DT_DIR)
>> +                     continue;
>
> I think this is wrong.
>
> On platforms that need a NO_D_TYPE_IN_DIRENT build, your compilation
> may fail here (you would need to lstat() it yourself).  See how
> dir.c does this without ugly #ifdef's in the code, especially around
> the use of get_dtype() and DTYPE() macro.
>
Thanks for the pointer, will fix.

-- larsh

Previous: Lars Hjemli
Message 11 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.