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

Re: [PATCHv5 3/3] submodule: Reimplement `module_clone` shell function in C

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Sep 3, 2015, 23:17 UTC
Message-ID
<CAPig+cTjXxo+iD7wkwrmHNQVDDYnqqHPEpVHNdVKCrYohb6adw@mail.gmail.com>
In-Reply-To
<1441230146-26921-4-git-send-email-sbeller@google.com>
On Wed, Sep 2, 2015 at 5:42 PM, Stefan Beller <sbeller@google.com> wrote:
Show 17 quoted lines
> This reimplements the helper function `module_clone` in shell
> in C as `clone`. This functionality is needed for converting
> `git submodule update` later on, which we want to add threading
> to.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> +static int module_clone(int argc, const char **argv, const char *prefix)
> +{
> +       /* Write a .git file in the submodule to redirect to the superproject. */
> +       if (safe_create_leading_directories_const(path) < 0)
> +               die(_("could not create directory '%s'"), path);
> +
> +       if (path && *path)
> +               strbuf_addf(&sb, "%s/.git", path);
> +       else
> +               strbuf_addf(&sb, ".git");
Minor: strbuf_addstr(...);
Show 6 quoted lines
> +       if (safe_create_leading_directories_const(sb.buf) < 0)
> +               die(_("could not create leading directories of '%s'"), sb.buf);
> +       submodule_dot_git = fopen(sb.buf, "w");
> +       if (!submodule_dot_git)
> +               die_errno(_("cannot open file '%s'"), sb.buf);
> +}
Previous: Junio C Hamano
Message 10 of 10 in “[PATCHv5 0/3] submodule--helper: Have some refactoring only patches first”
  1. Stefan BellerSep 2, 2015
  2. 1/3 submodule: Reimplement `module_list` shell function in CStefan Beller, Sep 2, 2015
  3. Junio C HamanoSep 3, 2015
  4. Stefan BellerSep 3, 2015
  5. 2/3 submodule: Reimplement `module_name` shell function in CStefan Beller, Sep 2, 2015
  6. 3/3 submodule: Reimplement `module_clone` shell function in CStefan Beller, Sep 2, 2015
  7. Junio C HamanoSep 3, 2015
  8. Stefan BellerSep 8, 2015
  9. Junio C HamanoSep 8, 2015
  10. Eric SunshineSep 3, 2015

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.