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

Re: git init --separate-git-dir does not update symbolic .git links for submodules

From
Stefan Beller <sbeller@google.com>
Date
Mar 7, 2017, 20:11 UTC
Message-ID
<CAGZ79kaFxN+0W8HDBB4Wnqy64UmdsRCCF2kZ852XsLNP=QNofA@mail.gmail.com>
In-Reply-To
<1488916365.8812.1@smtp.yandex.ru>
On Tue, Mar 7, 2017 at 11:52 AM, Valery Tolstov <me@vtolstov.org> wrote:
> Just noticed that there already is function that gives module list
> module_list_compute. But purpose of it's arguments is not quite clear
> for me at this moment.
>
static int module_list_compute(int argc, const char **argv,
                               const char *prefix,
                               struct pathspec *pathspec,
                               struct module_list *list)

argc, argv and prefix are just passed through from each caller argc is the number of arguments on the command line, argv is an array of said arguments on the command line, prefix is the position inside the repository.

e.g. If in git.git in Documentation/, you run a git command
"git submodule--helper module_list *"
then first "git" and "submodule--helper" are removed,
and then cmd_submodule__helper is called (at the end of
the submodule helper, which then sees
    argc=2, argv=["module_list", "*"],
    prefix="Documentation/"
which then proceeds to into module_list().

That parses these arguments, but there is no argument it knows about, so it does nothing.

Then it just passes these three (argc, argv, prefix) to module_list_compute, which then makes up the list, to be stored in the last parameter 'list'.

The 'pathspec' parameter seems weird. Internally the arguments mentioned above are converted to a pathspec, such that we can go through all files and call match_pathspec inside of module_list_compute.

In all but one cases we do not care about the pathspec, but in one case (in update_clone) we want to issue a warning if the pathspec was empty (i.e. the user just said "git submodule--helper update_clone" with no further path arguments)

Previous: Valery Tolstov
Message 2 of 2 in “Re: git init --separate-git-dir does not update symbolic .git links for submodules”
  1. Valery TolstovMar 7, 2017
  2. Stefan BellerMar 7, 2017

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.