[pacman-dev] [PATCH] makepkg: Use a recursive, shallow clone for git://

Daniel Wallace danielwallace at gtmanfred.com
Wed Oct 29 00:19:50 UTC 2014


This is worth noting

https://bugs.archlinux.org/task/23065

On Tue, Oct 28, 2014 at 7:13 PM, Drew DeVault <sircmpwn at gmail.com> wrote:

> makepkg: Use a recursive, shallow clone for git://
>
> This clones git submodules, which are required to build most projects
> that use them. This change is harmless for packages that don't use them.
>
> This also modifies the initial clone to use --depth=1, which avoids
> checking out the entire history and saves some bandwidth and improves
> the time required to clone.
>
> Signed-off-by: Drew DeVault <sir at cmpwn.com>
> ---
> I'm still not used to submitting patches through a mailing list, so I
> apologize if I've done something wrong. Please don't hesitate to let me
> know if there's something I could do better.
>
>  scripts/makepkg.sh.in | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 8a67d94..3b74d4d 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -542,7 +542,7 @@ download_git() {
>
>         if [[ ! -d "$dir" ]] || dir_is_empty "$dir" ; then
>                 msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
> -               if ! git clone --mirror "$url" "$dir"; then
> +               if ! git clone --depth=1 --mirror "$url" "$dir"; then
>                         error "$(gettext "Failure while downloading %s %s
> repo")" "${repo}" "git"
>                         plain "$(gettext "Aborting...")"
>                         exit 1
> @@ -612,6 +612,11 @@ extract_git() {
>                         plain "$(gettext "Aborting...")"
>                         exit 1
>                 fi
> +               if ! git submodule update --init --recursive ; then
> +                       error "$(gettext "Failure while initializing
> submodules of %s %s repo")" "${repo}" "git"
> +                       plain "$(gettext "Aborting...")"
> +                       exit 1
> +               fi
>         fi
>
>         popd &>/dev/null
> --
> 2.1.2
>


More information about the pacman-dev mailing list