Use-cases include Google Code (that doesn't support shallow clones) and random build systems that play with history and 'git describe'.
However, please use this sparingly. When the build can't go on without non-shallow clone, sure. But if it only results in non-pretty versions, I think users choosing EGIT_CLONE_TYPE=shallow explicitly are ready to deal with the fallout. --- eclass/git-r3.eclass | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass index 08b8ebb..33e66a6 100644 --- a/eclass/git-r3.eclass +++ b/eclass/git-r3.eclass @@ -58,6 +58,19 @@ fi # embedded systems with limited disk space. : ${EGIT_CLONE_TYPE:=single} +# @ECLASS-VARIABLE: EGIT_MIN_CLONE_TYPE +# @DESCRIPTION: +# 'Minimum' clone type supported by the ebuild. Takes same values +# as EGIT_CLONE_TYPE. When user sets a type that's 'lower' (that is, +# later on the list) than EGIT_MIN_CLONE_TYPE, the eclass uses +# EGIT_MIN_CLONE_TYPE instead. +# +# A common case is to use 'single' whenever the build system requires +# access to full branch history or the remote (Google Code) does not +# support shallow clones. Please use sparingly, and to fix fatal errors +# rather than 'non-pretty versions'. +: ${EGIT_MIN_CLONE_TYPE:=shallow} + # @ECLASS-VARIABLE: EGIT3_STORE_DIR # @DESCRIPTION: # Storage directory for git sources. @@ -140,6 +153,24 @@ _git-r3_env_setup() { *) die "Invalid EGIT_CLONE_TYPE=${EGIT_CLONE_TYPE}" esac + case "${EGIT_MIN_CLONE_TYPE}" in + shallow) + ;; + single) + if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then + ewarn "git-r3: ebuild needs to be cloned in 'single' mode, adjusting" + EGIT_CLONE_TYPE=single + fi + ;; + mirror) + if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then + ewarn "git-r3: ebuild needs to be cloned in 'mirror' mode, adjusting" + EGIT_CLONE_TYPE=mirror + fi + ;; + *) + die "Invalid EGIT_MIN_CLONE_TYPE=${EGIT_MIN_CLONE_TYPE}" + esac local esc_pn livevar esc_pn=${PN//[-+]/_} -- 1.8.3.2