diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-11-15 23:03:23 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-11-15 23:03:23 +0000 |
commit | 20dcac691a012ec45c2c84564f7d23b12617870c (patch) | |
tree | 20e64347b272ce502fc2340c0de0e005632f4549 /eclass | |
parent | Use PDEPEND to fix python-exec dep for all users, acked by ZeroChaos & mgorny... (diff) | |
download | gentoo-2-20dcac691a012ec45c2c84564f7d23b12617870c.tar.gz gentoo-2-20dcac691a012ec45c2c84564f7d23b12617870c.tar.bz2 gentoo-2-20dcac691a012ec45c2c84564f7d23b12617870c.zip |
Use shallow clones for local repos. Bug #491260.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 5 | ||||
-rw-r--r-- | eclass/git-r3.eclass | 20 |
2 files changed, 23 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 6e7d57379692..e7c2dd1a756a 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for eclass directory # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1055 2013/11/11 19:47:39 pesa Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1056 2013/11/15 23:03:23 mgorny Exp $ + + 15 Nov 2013; Michał Górny <mgorny@gentoo.org> git-r3.eclass: + Use shallow clones for local repos. Bug #491260. 11 Nov 2013; Davide Pesavento <pesa@gentoo.org> qt4-build.eclass: Sync with qt overlay. Changes should affect only live ebuilds. diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass index 5f6f8a37e6a1..03419721fd87 100644 --- a/eclass/git-r3.eclass +++ b/eclass/git-r3.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.22 2013/10/30 19:21:12 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.23 2013/11/15 23:03:23 mgorny Exp $ # @ECLASS: git-r3.eclass # @MAINTAINER: @@ -354,6 +354,20 @@ _git-r3_smart_fetch() { return ${main_ret} } +# @FUNCTION: _git-r3_is_local_repo +# @USAGE: <repo-uri> +# @INTERNAL +# @DESCRIPTION: +# Determine whether the given URI specifies a local (on-disk) +# repository. +_git-r3_is_local_repo() { + debug-print-function ${FUNCNAME} "$@" + + local uri=${1} + + [[ ${uri} == file://* || ${uri} == /* ]] +} + # @FUNCTION: git-r3_fetch # @USAGE: [<repo-uri> [<remote-ref> [<local-id>]]] # @DESCRIPTION: @@ -440,6 +454,10 @@ git-r3_fetch() { nonshallow=1 fi + # trying to do a shallow clone of a local repo makes git try to + # write to the repo. we don't want that to happen. + _git-r3_is_local_repo "${r}" && nonshallow=1 + # 1. if we need a non-shallow clone and we have a shallow one, # we need to unshallow it explicitly. # 2. if we want a shallow clone, we just pass '--depth 1' |