Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 337628 Details for
Bug 455048
git-2.eclass: Add support for submodules in non-bare clones
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Support for submodules in bare repositories
bare-submodules.patch (text/plain), 5.94 KB, created by
Hristo Venev
on 2013-02-01 20:37:03 UTC
(
hide
)
Description:
Support for submodules in bare repositories
Filename:
MIME Type:
Creator:
Hristo Venev
Created:
2013-02-01 20:37:03 UTC
Size:
5.94 KB
patch
obsolete
>--- git-2.eclass >+++ git-2.eclass >@@ -32,8 +32,7 @@ > # @ECLASS-VARIABLE: EGIT_HAS_SUBMODULES > # @DEFAULT_UNSET > # @DESCRIPTION: >-# If non-empty this variable enables support for git submodules in our >-# checkout. Also this makes the checkout to be non-bare for now. >+# If non-empty this variable enables support for git submodules in our clone. > > # @ECLASS-VARIABLE: EGIT_OPTIONS > # @DEFAULT_UNSET >@@ -113,9 +112,9 @@ > # @ECLASS-VARIABLE: EGIT_NONBARE > # @DEFAULT_UNSET > # @DESCRIPTION: >-# If non-empty this variable specifies that all checkouts will be done using >-# non bare repositories. This is useful if you can't operate with bare >-# checkouts for some reason. >+# If non-empty this variable specifies that all clones will be done using >+# non bare repositories. This is useful if you can't operate with bare clones >+# for some reason. > > # @ECLASS-VARIABLE: EGIT_NOUNPACK > # @DEFAULT_UNSET >@@ -178,44 +177,22 @@ > fi > > debug-print "${FUNCNAME}: working in \"${1}\"" >- pushd "${EGIT_DIR}" > /dev/null >+ pushd "${EGIT_SOURCEDIR}" > /dev/null > > debug-print "${FUNCNAME}: git submodule init" >- git submodule init || die >+ git --git-dir="${EGIT_DIR}" --work-tree=. \ >+ submodule init || die > debug-print "${FUNCNAME}: git submodule sync" >- git submodule sync || die >+ git --git-dir="${EGIT_DIR}" --work-tree=. \ >+ submodule sync || die > debug-print "${FUNCNAME}: git submodule update" >- git submodule update || die >+ git --git-dir="${EGIT_DIR}" --work-tree=. \ >+ submodule update || die > > popd > /dev/null > fi > } > >-# @FUNCTION: git-2_branch >-# @INTERNAL >-# @DESCRIPTION: >-# Internal function that changes branch for the repo based on EGIT_COMMIT and >-# EGIT_BRANCH variables. >-git-2_branch() { >- debug-print-function ${FUNCNAME} "$@" >- >- local branchname src >- >- debug-print "${FUNCNAME}: working in \"${EGIT_SOURCEDIR}\"" >- pushd "${EGIT_SOURCEDIR}" > /dev/null >- >- local branchname=branch-${EGIT_BRANCH} src=origin/${EGIT_BRANCH} >- if [[ ${EGIT_COMMIT} != ${EGIT_BRANCH} ]]; then >- branchname=tree-${EGIT_COMMIT} >- src=${EGIT_COMMIT} >- fi >- debug-print "${FUNCNAME}: git checkout -b ${branchname} ${src}" >- git checkout -b ${branchname} ${src} \ >- || die "${FUNCNAME}: changing the branch failed" >- >- popd > /dev/null >-} >- > # @FUNCTION: git-2_gc > # @INTERNAL > # @DESCRIPTION: >@@ -296,20 +273,23 @@ > debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." > } > >-# @FUNCTION: git-2_move_source >+# @FUNCTION: git-2_checkout > # @INTERNAL > # @DESCRIPTION: >-# Internal function moving sources from the EGIT_DIR to EGIT_SOURCEDIR dir. >-git-2_move_source() { >+# Internal function checking out sources from the EGIT_DIR to EGIT_SOURCEDIR. >+git-2_checkout() { > debug-print-function ${FUNCNAME} "$@" > >- debug-print "${FUNCNAME}: ${MOVE_COMMAND} \"${EGIT_DIR}\" \"${EGIT_SOURCEDIR}\"" >- pushd "${EGIT_DIR}" > /dev/null >- mkdir -p "${EGIT_SOURCEDIR}" \ >- || die "${FUNCNAME}: failed to create ${EGIT_SOURCEDIR}" >- ${MOVE_COMMAND} "${EGIT_SOURCEDIR}" \ >- || die "${FUNCNAME}: sync to \"${EGIT_SOURCEDIR}\" failed" >- popd > /dev/null >+ if ! [[ ${EGIT_LOCAL_NONBARE} ]]; then >+ mkdir -p "${EGIT_SOURCEDIR}" \ >+ || die "${FUNCNAME}: failed to create ${EGIT_SOURCEDIR}" >+ git --git-dir="${EGIT_DIR}" --work-tree="${EGIT_SOURCEDIR}" \ >+ checkout -f "${EGIT_COMMIT}" \ >+ || die "${FUNCNAME}: checkout to \"${EGIT_SOURCEDIR}\" failed" >+ else >+ cp -pPR "${EGIT_DIR}" "${EGIT_SOURCEDIR}" \ >+ || die "${FUNCNAME}: copy to \"${EGIT_SOURCEDIR}\" failed" >+ fi > } > > # @FUNCTION: git-2_initial_clone >@@ -428,7 +408,7 @@ > && echo " commit: ${EGIT_COMMIT}" > echo " branch: ${EGIT_BRANCH}" > echo " storage directory: \"${EGIT_DIR}\"" >- echo " checkout type: ${repo_type}" >+ echo " clone type: ${repo_type}" > > # Cleanup after git.eclass > if [[ ${EGIT_OLD_CLONE} ]]; then >@@ -446,7 +426,7 @@ > > # @ECLASS-VARIABLE: EGIT_BOOTSTRAP > # @DESCRIPTION: >- # Command to be executed after checkout and clone of the specified >+ # Command to be executed after clone and checkout of the specified > # repository. > # enviroment the package will fail if there is no update, thus in > # combination with --keep-going it would lead in not-updating >@@ -483,11 +463,9 @@ > # @FUNCTION: git-2_migrate_repository > # @INTERNAL > # @DESCRIPTION: >-# Internal function migrating between bare and normal checkout repository. >-# This is based on usage of EGIT_SUBMODULES, at least until they >-# start to work with bare checkouts sanely. >+# Internal function migrating between bare and nonbare clone repository. > # This function also set some global variables that differ between >-# bare and non-bare checkout. >+# bare and non-bare clone. > git-2_migrate_repository() { > debug-print-function ${FUNCNAME} "$@" > >@@ -495,7 +473,7 @@ > > # first find out if we have submodules > # or user explicitly wants us to use non-bare clones >- if ! [[ ${EGIT_HAS_SUBMODULES} || ${EGIT_NONBARE} ]]; then >+ if ! [[ ${EGIT_NONBARE} ]]; then > bare=1 > fi > >@@ -537,13 +515,11 @@ > if [[ ${bare} ]]; then > debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\"" > EGIT_LOCAL_OPTIONS+="${EGIT_OPTIONS} --bare" >- MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }" > EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}" > UPSTREAM_BRANCH="${EGIT_BRANCH}" > EGIT_LOCAL_NONBARE= > else > debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\"" >- MOVE_COMMAND="cp -pPR ." > EGIT_LOCAL_OPTIONS="${EGIT_OPTIONS}" > EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}" > UPSTREAM_BRANCH="origin/${EGIT_BRANCH}" >@@ -565,7 +541,6 @@ > # If ebuild writer polutes his environment it is > # his problem only. > unset EGIT_DIR >- unset MOVE_COMMAND > unset EGIT_LOCAL_OPTIONS > unset EGIT_UPDATE_CMD > unset UPSTREAM_BRANCH >@@ -583,9 +558,8 @@ > git-2_migrate_repository > git-2_fetch "$@" > git-2_gc >+ git-2_checkout > git-2_submodules >- git-2_move_source >- git-2_branch > git-2_bootstrap > git-2_cleanup > echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 455048
: 337628