diff options
author | Michał Górny <mgorny@gentoo.org> | 2014-02-25 13:01:49 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2014-02-25 13:01:49 +0000 |
commit | 0bf3f26711ed5d41701bda51257241f79daf9f07 (patch) | |
tree | 998aed2a59d888dd52c910f6027f3d27b6c5df64 /eclass | |
parent | Stable for amd64 wrt bug #499828 (diff) | |
download | gentoo-2-0bf3f26711ed5d41701bda51257241f79daf9f07.tar.gz gentoo-2-0bf3f26711ed5d41701bda51257241f79daf9f07.tar.bz2 gentoo-2-0bf3f26711ed5d41701bda51257241f79daf9f07.zip |
Use git init+fetch rather than clone in order to fix checking out to non-empty directory. Fixes bug #502400.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 6 | ||||
-rw-r--r-- | eclass/git-r3.eclass | 21 |
2 files changed, 19 insertions, 8 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index ce4ce91031c8..d7365152da2f 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for eclass directory # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1147 2014/02/24 08:43:34 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1148 2014/02/25 13:01:49 mgorny Exp $ + + 25 Feb 2014; Michał Górny <mgorny@gentoo.org> git-r3.eclass: + Use git init+fetch rather than clone in order to fix checking out to + non-empty directory. Fixes bug #502400. 24 Feb 2014; Michał Górny <mgorny@gentoo.org> git-r3.eclass: Fetch and preserve git notes as well. diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass index fe49fc224b0b..d726cee8bf2c 100644 --- a/eclass/git-r3.eclass +++ b/eclass/git-r3.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.25 2014/02/24 08:43:34 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/git-r3.eclass,v 1.26 2014/02/25 13:01:49 mgorny Exp $ # @ECLASS: git-r3.eclass # @MAINTAINER: @@ -444,17 +444,24 @@ git-r3_checkout() { git rev-parse --verify refs/git-r3/"${local_id}"/__main__ ) - set -- git clone --quiet --shared --no-checkout "${GIT_DIR}" "${out_dir}"/ - echo "${@}" >&2 - "${@}" || die "git clone (for checkout) failed" - git-r3_sub_checkout() { local orig_repo=${GIT_DIR} local -x GIT_DIR=${out_dir}/.git local -x GIT_WORK_TREE=${out_dir} - # pull notes - git fetch "${orig_repo}" "refs/notes/*:refs/notes/*" || die + mkdir -p "${out_dir}" || die + + # use git init+fetch instead of clone since the latter doesn't like + # non-empty directories. + + git init --quiet || die + set -- git fetch --update-head-ok "${orig_repo}" \ + "refs/heads/*:refs/heads/*" \ + "refs/tags/*:refs/tags/*" \ + "refs/notes/*:refs/notes/*" + + echo "${@}" >&2 + "${@}" || die "git fetch into checkout dir failed" set -- git checkout --quiet if [[ ${remote_ref} ]]; then |