diff --git a/doc/makepkg.8.asciidoc b/doc/makepkg.8.asciidoc index 38032e7b..d023b038 100644 --- a/doc/makepkg.8.asciidoc +++ b/doc/makepkg.8.asciidoc @@ -287,6 +287,10 @@ Environment Variables **BUILDTOOLVER=**"":: The version of the '$BUILDTOOL' used. +**GITFLAGS**:: + The options to pass when checking out git sources, replacing the default + "--mirror". + Configuration ------------- See linkman:makepkg.conf[5] for more details on configuring makepkg using the diff --git a/scripts/libmakepkg/source/git.sh.in b/scripts/libmakepkg/source/git.sh.in index bcff958d..f809cc9e 100644 --- a/scripts/libmakepkg/source/git.sh.in +++ b/scripts/libmakepkg/source/git.sh.in @@ -46,9 +46,12 @@ download_git() { url=${url%%#*} url=${url%%\?*} + # Allow overriding of options passed to git clone command, e.g. --filter=blob:none for partial cloning of big repos + local gitflags=${GITFLAGS:---mirror} + 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 $GITFLAGS "$url" "$dir"; then error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git" plainerr "$(gettext "Aborting...")" exit 1