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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 2, 2015 at 5:42 PM, Stefan Beller <sbeller@xxxxxxxxxx> wrote:
> 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@xxxxxxxxxx>
> ---
> +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(...);

> +       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);
> +}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]