Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 210322 Details for
Bug 269491
git.eclass Invent some robust yet fast way to clone from ${DISTDIR} to ${S}
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
git.eclass.diff
git.eclass.diff (text/plain), 5.15 KB, created by
Tomáš Chvátal (RETIRED)
on 2009-11-15 15:49:09 UTC
(
hide
)
Description:
git.eclass.diff
Filename:
MIME Type:
Creator:
Tomáš Chvátal (RETIRED)
Created:
2009-11-15 15:49:09 UTC
Size:
5.15 KB
patch
obsolete
>Index: git.eclass >=================================================================== >RCS file: /var/cvsroot/gentoo-x86/eclass/git.eclass,v >retrieving revision 1.31 >diff -u -b -B -r1.31 git.eclass >--- git.eclass 20 Oct 2009 10:05:47 -0000 1.31 >+++ git.eclass 15 Nov 2009 15:46:34 -0000 >@@ -47,12 +47,12 @@ > # @ECLASS-VARIABLE: EGIT_FETCH_CMD > # @DESCRIPTION: > # Command for cloning the repository. >-: ${EGIT_FETCH_CMD:="git clone --bare"} >+: ${EGIT_FETCH_CMD:="git clone"} > > # @ECLASS-VARIABLE: EGIT_UPDATE_CMD > # @DESCRIPTION: > # Git fetch command. >-EGIT_UPDATE_CMD="git fetch -f -u" >+EGIT_UPDATE_CMD="git pull" > > # @ECLASS-VARIABLE: EGIT_DIFFSTAT_CMD > # @DESCRIPTION: >@@ -138,17 +138,27 @@ > > # @ECLASS-VARIABLE: EGIT_PRUNE > # @DESCRIPTION: >-# git.eclass can prune the local clone. This is useful if upstream rewinds and >+# git eclass can prune the local clone. This is useful if upstream rewinds and > # rebases branches too often. > : ${EGIT_PRUNE:=false} > >+# @FUNCTION: git_submodules >+# @DESCRIPTION: >+# Internal function wrapping the submodule initialisation and update >+git_sumbodules() { >+ debug-print "git submodule init" >+ git submodule init 2>&1 > /dev/null >+ debug-print "git submodule update" >+ git submodule update 2>&1 > /dev/null >+} >+ > # @FUNCTION: git_fetch > # @DESCRIPTION: > # Gets repository from EGIT_REPO_URI and store it in specified EGIT_STORE_DIR > git_fetch() { > debug-print-function ${FUNCNAME} "$@" > >- local EGIT_CLONE_DIR oldsha1 cursha1 >+ local GIT_DIR EGIT_CLONE_DIR oldsha1 cursha1 > > # choose if user wants elog or just einfo. > if [[ ${EGIT_QUIET} != OFF ]]; then >@@ -196,33 +206,44 @@ > > debug-print "${FUNCNAME}: EGIT_OPTIONS = \"${EGIT_OPTIONS}\"" > >- export GIT_DIR="${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" >- >+ GIT_DIR="${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" >+ pushd ${EGIT_STORE_DIR} &> /dev/null > # we also have to remove all shallow copied repositories > # and fetch them again >- if [[ -e "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}/shallow" ]]; then >- rm -rf "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" >+ if [[ -e "${GIT_DIR}/shallow" ]]; then >+ rm -rf "${GIT_DIR}" > einfo "The ${EGIT_CLONE_DIR} was shallow copy. Refetching." > fi >+ # repack from bare copy to normal one >+ if [[ -d ${GIT_DIR} && ! -d "${GIT_DIR}/.git/" ]]; then >+ rm -rf "${GIT_DIR}" >+ einfo "The ${EGIT_CLONE_DIR} was bare copy. Refetching." >+ fi > >- if [[ ! -d ${EGIT_CLONE_DIR} ]] ; then >+ if [[ ! -d ${GIT_DIR} ]] ; then > # first clone > ${elogcmd} "GIT NEW clone -->" > ${elogcmd} " repository: ${EGIT_REPO_URI}" > >- ${EGIT_FETCH_CMD} ${EGIT_OPTIONS} "${EGIT_REPO_URI}" ${EGIT_PROJECT} \ >+ debug-print "${EGIT_FETCH_CMD} ${EGIT_OPTIONS} \"${EGIT_REPO_URI}\" ${GIT_DIR}" >+ ${EGIT_FETCH_CMD} ${EGIT_OPTIONS} "${EGIT_REPO_URI}" ${GIT_DIR} \ > || die "${EGIT}: can't fetch from ${EGIT_REPO_URI}." > >+ pushd "${GIT_DIR}" &> /dev/null > cursha1=$(git rev-parse ${EGIT_BRANCH}) > ${elogcmd} " at the commit: ${cursha1}" >- # We use --bare cloning, so git doesn't do this for us. >- git config remote.origin.url "${EGIT_REPO_URI}" >+ >+ git_sumbodules >+ popd &> /dev/null > elif [[ -n ${EGIT_OFFLINE} ]] ; then >+ pushd "${GIT_DIR}" &> /dev/null > cursha1=$(git rev-parse ${EGIT_BRANCH}) > ${elogcmd} "GIT offline update -->" > ${elogcmd} " repository: ${EGIT_REPO_URI}" > ${elogcmd} " at the commit: ${cursha1}" >+ popd &> /dev/null > else >+ pushd "${GIT_DIR}" &> /dev/null > # Git urls might change, so unconditionally set it here > git config remote.origin.url "${EGIT_REPO_URI}" > >@@ -232,10 +253,11 @@ > > oldsha1=$(git rev-parse ${EGIT_BRANCH}) > >- ${elogcmd} ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH} >+ debug-print "${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH}" > ${EGIT_UPDATE_CMD} ${EGIT_OPTIONS} origin ${EGIT_BRANCH}:${EGIT_BRANCH} \ > || die "${EGIT}: can't update from ${EGIT_REPO_URI}." > >+ git_sumbodules > cursha1=$(git rev-parse ${EGIT_BRANCH}) > > # write out message based on the revisions >@@ -256,13 +278,16 @@ > die "${EGIT}: Repository \"${EGIT_REPO_URI}\" is up-to-date. Skipping." > fi > ${EGIT_DIFFSTAT_CMD} ${oldsha1}..${EGIT_BRANCH} >+ popd &> /dev/null > fi > >+ pushd "${GIT_DIR}" &> /dev/null > if ${EGIT_REPACK} || ${EGIT_PRUNE} ; then > ebegin "Garbage collecting the repository" > git gc $(${EGIT_PRUNE} && echo '--prune') > eend $? > fi >+ popd &> /dev/null > > # export the git version > export EGIT_VERSION="${cursha1}" >@@ -272,9 +297,9 @@ > ${elogcmd} " storage directory: \"${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}\"" > > # unpack to the ${S} >- unset GIT_DIR >- debug-print "git clone -l -s -n \"${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}\" \"${S}\"" >- git clone -l -s -n "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" "${S}" >+ popd &> /dev/null >+ debug-print "cp -aR \"${GIT_DIR}\" \"${S}\"" >+ cp -aR "${GIT_DIR}" "${S}" > > # set correct branch and the tree ebuild specified > pushd "${S}" > /dev/null >@@ -285,10 +310,7 @@ > fi > debug-print "git checkout -b ${branchname} ${src}" > git checkout -b ${branchname} ${src} 2>&1 > /dev/null >- debug-print "git submodule init" >- git submodule init 2>&1 > /dev/null >- debug-print "git submodule update" >- git submodule update 2>&1 > /dev/null >+ git_sumbodules > popd > /dev/null > > unset branchname src
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 269491
:
198718
|
210312
|
210313
|
210322
|
217009