Commit e017a597 authored by solo turn's avatar solo turn Committed by Allan McRae
Browse files

makepkg: Add GITFLAGS environmental variable to customise checkout

The default flag used to clone a git repository when using makepkg
is "--mirror". However, when working with huge repositories, the use
of different flags during cloning can allow an faster checkout. For
example, using "--filter=blob:none" allows for small checkouts, at
the expense of requiring downloads during the build stage if anything
but the HEAD commit is used for the build. In addition, this example
would serve as a replacement for the often requested (but broken)
addition of --depth=1.

Add support for the environment variable GITFLAG to pass flags for
the git clone command. Note that this overrides the default rather
than adding to it in order to prevent incompatibilities.
parent 79bd5121
Pipeline #23583 passed with stage
in 2 minutes and 11 seconds
......@@ -287,6 +287,10 @@ Environment Variables
The version of the '$BUILDTOOL' used.
The options to pass when checking out git sources, replacing the default
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
......@@ -46,9 +46,12 @@ download_git() {
# 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment