/[gentoo-x86]/eclass/git-2.eclass
Gentoo

Diff of /eclass/git-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.14 Revision 1.24
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.14 2011/08/22 04:46:31 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/git-2.eclass,v 1.24 2011/09/23 13:58:58 mgorny Exp $
4 4
5# @ECLASS: git-2.eclass 5# @ECLASS: git-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Donnie Berkholz <dberkholz@gentoo.org> 7# Donnie Berkholz <dberkholz@gentoo.org>
8# @BLURB: Eclass for fetching and unpacking git repositories. 8# @BLURB: Eclass for fetching and unpacking git repositories.
118# @DESCRIPTION: 118# @DESCRIPTION:
119# If non-empty this variable bans unpacking of ${A} content into the srcdir. 119# If non-empty this variable bans unpacking of ${A} content into the srcdir.
120# Default behaviour is to unpack ${A} content. 120# Default behaviour is to unpack ${A} content.
121 121
122# @FUNCTION: git-2_init_variables 122# @FUNCTION: git-2_init_variables
123# @INTERNAL
123# @DESCRIPTION: 124# @DESCRIPTION:
124# Internal function initializing all git variables. 125# Internal function initializing all git variables.
125# We define it in function scope so user can define 126# We define it in function scope so user can define
126# all the variables before and after inherit. 127# all the variables before and after inherit.
127git-2_init_variables() { 128git-2_init_variables() {
128 debug-print-function ${FUNCNAME} "$@" 129 debug-print-function ${FUNCNAME} "$@"
129 130
130 local x 131 local esc_pn liverepo livebranch livecommit
132 esc_pn=${PN//[-+]/_}
131 133
132 : ${EGIT_SOURCEDIR="${S}"} 134 : ${EGIT_SOURCEDIR="${S}"}
133 135
134 : ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/egit-src"} 136 : ${EGIT_STORE_DIR:="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/egit-src"}
135 137
137 139
138 : ${EGIT_OPTIONS:=} 140 : ${EGIT_OPTIONS:=}
139 141
140 : ${EGIT_MASTER:=master} 142 : ${EGIT_MASTER:=master}
141 143
142 eval x="\$${PN//[-+]/_}_LIVE_REPO" 144 liverepo=${esc_pn}_LIVE_REPO
143 EGIT_REPO_URI=${x:-${EGIT_REPO_URI}} 145 EGIT_REPO_URI=${!liverepo:-${EGIT_REPO_URI}}
144 [[ -z ${EGIT_REPO_URI} ]] && die "EGIT_REPO_URI must have some value" 146 [[ ${EGIT_REPO_URI} ]] || die "EGIT_REPO_URI must have some value"
145 147
146 : ${EVCS_OFFLINE:=} 148 : ${EVCS_OFFLINE:=}
147 149
148 eval x="\$${PN//[-+]/_}_LIVE_BRANCH" 150 livebranch=${esc_pn}_LIVE_BRANCH
149 [[ -n ${x} ]] && ewarn "QA: using \"${PN//[-+]/_}_LIVE_BRANCH\" variable, you won't get any support" 151 [[ ${!livebranch} ]] && ewarn "QA: using \"${esc_pn}_LIVE_BRANCH\" variable, you won't get any support"
150 EGIT_BRANCH=${x:-${EGIT_BRANCH:-${EGIT_MASTER}}} 152 EGIT_BRANCH=${!livebranch:-${EGIT_BRANCH:-${EGIT_MASTER}}}
151 153
152 eval x="\$${PN//[-+]/_}_LIVE_COMMIT" 154 livecommit=${esc_pn}_LIVE_COMMIT
153 [[ -n ${x} ]] && ewarn "QA: using \"${PN//[-+]/_}_LIVE_COMMIT\" variable, you won't get any support" 155 [[ ${!livecommit} ]] && ewarn "QA: using \"${esc_pn}_LIVE_COMMIT\" variable, you won't get any support"
154 EGIT_COMMIT=${x:-${EGIT_COMMIT:-${EGIT_BRANCH}}} 156 EGIT_COMMIT=${!livecommit:-${EGIT_COMMIT:-${EGIT_BRANCH}}}
155 157
156 : ${EGIT_REPACK:=} 158 : ${EGIT_REPACK:=}
157 159
158 : ${EGIT_PRUNE:=} 160 : ${EGIT_PRUNE:=}
159} 161}
160 162
161# @FUNCTION: git-2_submodules 163# @FUNCTION: git-2_submodules
164# @INTERNAL
162# @DESCRIPTION: 165# @DESCRIPTION:
163# Internal function wrapping the submodule initialisation and update. 166# Internal function wrapping the submodule initialisation and update.
164git-2_submodules() { 167git-2_submodules() {
165 debug-print-function ${FUNCNAME} "$@" 168 debug-print-function ${FUNCNAME} "$@"
166 if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then 169 if [[ ${EGIT_HAS_SUBMODULES} ]]; then
167 if [[ -n ${EVCS_OFFLINE} ]]; then 170 if [[ ${EVCS_OFFLINE} ]]; then
168 # for submodules operations we need to be online 171 # for submodules operations we need to be online
169 debug-print "${FUNCNAME}: not updating submodules in offline mode" 172 debug-print "${FUNCNAME}: not updating submodules in offline mode"
170 return 1 173 return 1
171 fi 174 fi
172 175
183 popd > /dev/null 186 popd > /dev/null
184 fi 187 fi
185} 188}
186 189
187# @FUNCTION: git-2_branch 190# @FUNCTION: git-2_branch
191# @INTERNAL
188# @DESCRIPTION: 192# @DESCRIPTION:
189# Internal function that changes branch for the repo based on EGIT_COMMIT and 193# Internal function that changes branch for the repo based on EGIT_COMMIT and
190# EGIT_BRANCH variables. 194# EGIT_BRANCH variables.
191git-2_branch() { 195git-2_branch() {
192 debug-print-function ${FUNCNAME} "$@" 196 debug-print-function ${FUNCNAME} "$@"
207 211
208 popd > /dev/null 212 popd > /dev/null
209} 213}
210 214
211# @FUNCTION: git-2_gc 215# @FUNCTION: git-2_gc
216# @INTERNAL
212# @DESCRIPTION: 217# @DESCRIPTION:
213# Internal function running garbage collector on checked out tree. 218# Internal function running garbage collector on checked out tree.
214git-2_gc() { 219git-2_gc() {
215 debug-print-function ${FUNCNAME} "$@" 220 debug-print-function ${FUNCNAME} "$@"
216 221
217 local args 222 local args
218 223
224 if [[ ${EGIT_REPACK} || ${EGIT_PRUNE} ]]; then
219 pushd "${EGIT_DIR}" > /dev/null 225 pushd "${EGIT_DIR}" > /dev/null
220 if [[ -n ${EGIT_REPACK} || -n ${EGIT_PRUNE} ]]; then
221 ebegin "Garbage collecting the repository" 226 ebegin "Garbage collecting the repository"
222 [[ -n ${EGIT_PRUNE} ]] && args='--prune' 227 [[ ${EGIT_PRUNE} ]] && args='--prune'
223 debug-print "${FUNCNAME}: git gc ${args}" 228 debug-print "${FUNCNAME}: git gc ${args}"
224 git gc ${args} 229 git gc ${args}
225 eend $? 230 eend $?
226 fi
227 popd > /dev/null 231 popd > /dev/null
232 fi
228} 233}
229 234
230# @FUNCTION: git-2_prepare_storedir 235# @FUNCTION: git-2_prepare_storedir
236# @INTERNAL
231# @DESCRIPTION: 237# @DESCRIPTION:
232# Internal function preparing directory where we are going to store SCM 238# Internal function preparing directory where we are going to store SCM
233# repository. 239# repository.
234git-2_prepare_storedir() { 240git-2_prepare_storedir() {
235 debug-print-function ${FUNCNAME} "$@" 241 debug-print-function ${FUNCNAME} "$@"
248 # allow writing into EGIT_STORE_DIR 254 # allow writing into EGIT_STORE_DIR
249 addwrite "${EGIT_STORE_DIR}" 255 addwrite "${EGIT_STORE_DIR}"
250 # calculate the proper store dir for data 256 # calculate the proper store dir for data
251 # If user didn't specify the EGIT_DIR, we check if he did specify 257 # If user didn't specify the EGIT_DIR, we check if he did specify
252 # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI. 258 # the EGIT_PROJECT or get the folder name from EGIT_REPO_URI.
253 [[ -z ${EGIT_REPO_URI##*/} ]] && EGIT_REPO_URI="${EGIT_REPO_URI%/}" 259 EGIT_REPO_URI=${EGIT_REPO_URI%/}
254 if [[ -z ${EGIT_DIR} ]]; then 260 if [[ ! ${EGIT_DIR} ]]; then
255 if [[ -n ${EGIT_PROJECT} ]]; then 261 if [[ ${EGIT_PROJECT} ]]; then
256 clone_dir=${EGIT_PROJECT} 262 clone_dir=${EGIT_PROJECT}
257 else 263 else
258 clone_dir=${EGIT_REPO_URI##*/} 264 clone_dir=${EGIT_REPO_URI##*/}
259 fi 265 fi
260 EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir} 266 EGIT_DIR=${EGIT_STORE_DIR}/${clone_dir}
267
268 # Try to migrate from git.eclass git-src/
269 if [[ ! -d ${EGIT_DIR} && ${EGIT_STORE_DIR} == */egit-src ]]; then
270 local old_store_dir=${EGIT_STORE_DIR/%egit-src/git-src}
271 local old_location=${old_store_dir}/${EGIT_PROJECT:-${PN}}
272
273 if [[ -d ${old_location} ]]; then
274 elog "${FUNCNAME}: ${CATEGORY}/${PF} will be cloned from old location."
275 elog "It will be necessary to rebuild the package to fetch updates."
276 EGIT_REPO_URI="${old_location} ${EGIT_REPO_URI}"
277 fi
278 fi
261 fi 279 fi
262 export EGIT_DIR=${EGIT_DIR} 280 export EGIT_DIR=${EGIT_DIR}
263 debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"." 281 debug-print "${FUNCNAME}: Storing the repo into \"${EGIT_DIR}\"."
264} 282}
265 283
266# @FUNCTION: git-2_move_source 284# @FUNCTION: git-2_move_source
285# @INTERNAL
267# @DESCRIPTION: 286# @DESCRIPTION:
268# Internal function moving sources from the EGIT_DIR to EGIT_SOURCEDIR dir. 287# Internal function moving sources from the EGIT_DIR to EGIT_SOURCEDIR dir.
269git-2_move_source() { 288git-2_move_source() {
270 debug-print-function ${FUNCNAME} "$@" 289 debug-print-function ${FUNCNAME} "$@"
271 290
277 || die "${FUNCNAME}: sync to \"${EGIT_SOURCEDIR}\" failed" 296 || die "${FUNCNAME}: sync to \"${EGIT_SOURCEDIR}\" failed"
278 popd > /dev/null 297 popd > /dev/null
279} 298}
280 299
281# @FUNCTION: git-2_initial_clone 300# @FUNCTION: git-2_initial_clone
301# @INTERNAL
282# @DESCRIPTION: 302# @DESCRIPTION:
283# Internal function running initial clone on specified repo_uri. 303# Internal function running initial clone on specified repo_uri.
284git-2_initial_clone() { 304git-2_initial_clone() {
285 debug-print-function ${FUNCNAME} "$@" 305 debug-print-function ${FUNCNAME} "$@"
286 306
287 local repo_uri 307 local repo_uri
288 308
289 EGIT_REPO_URI_SELECTED="" 309 EGIT_REPO_URI_SELECTED=""
290 for repo_uri in ${EGIT_REPO_URI}; do 310 for repo_uri in ${EGIT_REPO_URI}; do
291 debug-print "${FUNCNAME}: git clone ${EGIT_LOCAL_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\"" 311 debug-print "${FUNCNAME}: git clone ${EGIT_LOCAL_OPTIONS} \"${repo_uri}\" \"${EGIT_DIR}\""
292 git clone ${EGIT_LOCAL_OPTIONS} "${repo_uri}" "${EGIT_DIR}" 312 if git clone ${EGIT_LOCAL_OPTIONS} "${repo_uri}" "${EGIT_DIR}"; then
293 if [[ $? -eq 0 ]]; then
294 # global variable containing the repo_name we will be using 313 # global variable containing the repo_name we will be using
295 debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\"" 314 debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
296 EGIT_REPO_URI_SELECTED="${repo_uri}" 315 EGIT_REPO_URI_SELECTED="${repo_uri}"
297 break 316 break
298 fi 317 fi
299 done 318 done
300 319
301 if [[ -z ${EGIT_REPO_URI_SELECTED} ]]; then 320 [[ ${EGIT_REPO_URI_SELECTED} ]] \
302 die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}" 321 || die "${FUNCNAME}: can't fetch from ${EGIT_REPO_URI}"
303 fi
304} 322}
305 323
306# @FUNCTION: git-2_update_repo 324# @FUNCTION: git-2_update_repo
325# @INTERNAL
307# @DESCRIPTION: 326# @DESCRIPTION:
308# Internal function running update command on specified repo_uri. 327# Internal function running update command on specified repo_uri.
309git-2_update_repo() { 328git-2_update_repo() {
310 debug-print-function ${FUNCNAME} "$@" 329 debug-print-function ${FUNCNAME} "$@"
311 330
312 local repo_uri 331 local repo_uri
313 332
314 if [[ -n ${EGIT_LOCAL_NONBARE} ]]; then 333 if [[ ${EGIT_LOCAL_NONBARE} ]]; then
315 # checkout master branch and drop all other local branches 334 # checkout master branch and drop all other local branches
316 git checkout ${EGIT_MASTER} || die "${FUNCNAME}: can't checkout master branch ${EGIT_MASTER}" 335 git checkout ${EGIT_MASTER} || die "${FUNCNAME}: can't checkout master branch ${EGIT_MASTER}"
317 for x in $(git branch | grep -v "* ${EGIT_MASTER}" | tr '\n' ' '); do 336 for x in $(git branch | grep -v "* ${EGIT_MASTER}" | tr '\n' ' '); do
318 debug-print "${FUNCNAME}: git branch -D ${x}" 337 debug-print "${FUNCNAME}: git branch -D ${x}"
319 git branch -D ${x} > /dev/null 338 git branch -D ${x} > /dev/null
324 for repo_uri in ${EGIT_REPO_URI}; do 343 for repo_uri in ${EGIT_REPO_URI}; do
325 # git urls might change, so reset it 344 # git urls might change, so reset it
326 git config remote.origin.url "${repo_uri}" 345 git config remote.origin.url "${repo_uri}"
327 346
328 debug-print "${EGIT_UPDATE_CMD}" 347 debug-print "${EGIT_UPDATE_CMD}"
329 ${EGIT_UPDATE_CMD} > /dev/null 348 if ${EGIT_UPDATE_CMD} > /dev/null; then
330 if [[ $? -eq 0 ]]; then
331 # global variable containing the repo_name we will be using 349 # global variable containing the repo_name we will be using
332 debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\"" 350 debug-print "${FUNCNAME}: EGIT_REPO_URI_SELECTED=\"${repo_uri}\""
333 EGIT_REPO_URI_SELECTED="${repo_uri}" 351 EGIT_REPO_URI_SELECTED="${repo_uri}"
334 break 352 break
335 fi 353 fi
336 done 354 done
337 355
338 if [[ -z ${EGIT_REPO_URI_SELECTED} ]]; then 356 [[ ${EGIT_REPO_URI_SELECTED} ]] \
339 die "${FUNCNAME}: can't update from ${EGIT_REPO_URI}" 357 || die "${FUNCNAME}: can't update from ${EGIT_REPO_URI}"
340 fi
341} 358}
342 359
343# @FUNCTION: git-2_fetch 360# @FUNCTION: git-2_fetch
361# @INTERNAL
344# @DESCRIPTION: 362# @DESCRIPTION:
345# Internal function fetching repository from EGIT_REPO_URI and storing it in 363# Internal function fetching repository from EGIT_REPO_URI and storing it in
346# specified EGIT_STORE_DIR. 364# specified EGIT_STORE_DIR.
347git-2_fetch() { 365git-2_fetch() {
348 debug-print-function ${FUNCNAME} "$@" 366 debug-print-function ${FUNCNAME} "$@"
349 367
350 local oldsha cursha repo_type 368 local oldsha cursha repo_type
351 369
352 [[ -n ${EGIT_LOCAL_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository" 370 [[ ${EGIT_LOCAL_NONBARE} ]] && repo_type="non-bare repository" || repo_type="bare repository"
353 371
354 if [[ ! -d ${EGIT_DIR} ]]; then 372 if [[ ! -d ${EGIT_DIR} ]]; then
355 git-2_initial_clone 373 git-2_initial_clone
356 pushd "${EGIT_DIR}" > /dev/null 374 pushd "${EGIT_DIR}" > /dev/null
357 cursha=$(git rev-parse ${UPSTREAM_BRANCH}) 375 cursha=$(git rev-parse ${UPSTREAM_BRANCH})
358 echo "GIT NEW clone -->" 376 echo "GIT NEW clone -->"
359 echo " repository: ${EGIT_REPO_URI_SELECTED}" 377 echo " repository: ${EGIT_REPO_URI_SELECTED}"
360 echo " at the commit: ${cursha}" 378 echo " at the commit: ${cursha}"
361 379
362 popd > /dev/null 380 popd > /dev/null
363 elif [[ -n ${EVCS_OFFLINE} ]]; then 381 elif [[ ${EVCS_OFFLINE} ]]; then
364 pushd "${EGIT_DIR}" > /dev/null 382 pushd "${EGIT_DIR}" > /dev/null
365 cursha=$(git rev-parse ${UPSTREAM_BRANCH}) 383 cursha=$(git rev-parse ${UPSTREAM_BRANCH})
366 echo "GIT offline update -->" 384 echo "GIT offline update -->"
367 echo " repository: $(git config remote.origin.url)" 385 echo " repository: $(git config remote.origin.url)"
368 echo " at the commit: ${cursha}" 386 echo " at the commit: ${cursha}"
397 echo " storage directory: \"${EGIT_DIR}\"" 415 echo " storage directory: \"${EGIT_DIR}\""
398 echo " checkout type: ${repo_type}" 416 echo " checkout type: ${repo_type}"
399} 417}
400 418
401# @FUNCTION: git_bootstrap 419# @FUNCTION: git_bootstrap
420# @INTERNAL
402# @DESCRIPTION: 421# @DESCRIPTION:
403# Internal function that runs bootstrap command on unpacked source. 422# Internal function that runs bootstrap command on unpacked source.
404git-2_bootstrap() { 423git-2_bootstrap() {
405 debug-print-function ${FUNCNAME} "$@" 424 debug-print-function ${FUNCNAME} "$@"
406 425
409 # Command to be executed after checkout and clone of the specified 428 # Command to be executed after checkout and clone of the specified
410 # repository. 429 # repository.
411 # enviroment the package will fail if there is no update, thus in 430 # enviroment the package will fail if there is no update, thus in
412 # combination with --keep-going it would lead in not-updating 431 # combination with --keep-going it would lead in not-updating
413 # pakcages that are up-to-date. 432 # pakcages that are up-to-date.
414 if [[ -n ${EGIT_BOOTSTRAP} ]]; then 433 if [[ ${EGIT_BOOTSTRAP} ]]; then
415 pushd "${EGIT_SOURCEDIR}" > /dev/null 434 pushd "${EGIT_SOURCEDIR}" > /dev/null
416 einfo "Starting bootstrap" 435 einfo "Starting bootstrap"
417 436
418 if [[ -f ${EGIT_BOOTSTRAP} ]]; then 437 if [[ -f ${EGIT_BOOTSTRAP} ]]; then
419 # we have file in the repo which we should execute 438 # we have file in the repo which we should execute
439 popd > /dev/null 458 popd > /dev/null
440 fi 459 fi
441} 460}
442 461
443# @FUNCTION: git-2_migrate_repository 462# @FUNCTION: git-2_migrate_repository
463# @INTERNAL
444# @DESCRIPTION: 464# @DESCRIPTION:
445# Internal function migrating between bare and normal checkout repository. 465# Internal function migrating between bare and normal checkout repository.
446# This is based on usage of EGIT_SUBMODULES, at least until they 466# This is based on usage of EGIT_SUBMODULES, at least until they
447# start to work with bare checkouts sanely. 467# start to work with bare checkouts sanely.
448# This function also set some global variables that differ between 468# This function also set some global variables that differ between
449# bare and non-bare checkout. 469# bare and non-bare checkout.
450git-2_migrate_repository() { 470git-2_migrate_repository() {
451 debug-print-function ${FUNCNAME} "$@" 471 debug-print-function ${FUNCNAME} "$@"
452 472
453 local target returnstate 473 local bare returnstate
454 474
455 # first find out if we have submodules 475 # first find out if we have submodules
476 # or user explicitly wants us to use non-bare clones
456 if [[ -z ${EGIT_HAS_SUBMODULES} ]]; then 477 if ! [[ ${EGIT_HAS_SUBMODULES} || ${EGIT_NONBARE} ]]; then
457 target="bare" 478 bare=1
458 else
459 target="full"
460 fi
461 # check if user didn't specify that we want non-bare repo
462 if [[ -n ${EGIT_NONBARE} ]]; then
463 target="full"
464 EGIT_LOCAL_NONBARE="true"
465 fi 479 fi
466 480
467 # test if we already have some repo and if so find out if we have 481 # test if we already have some repo and if so find out if we have
468 # to migrate the data 482 # to migrate the data
469 if [[ -d ${EGIT_DIR} ]]; then 483 if [[ -d ${EGIT_DIR} ]]; then
470 if [[ ${target} == bare && -d ${EGIT_DIR}/.git ]]; then 484 if [[ ${bare} && -d ${EGIT_DIR}/.git ]]; then
471 debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to bare copy" 485 debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to bare copy"
472 486
473 ebegin "Converting \"${EGIT_DIR}\" from non-bare to bare copy" 487 ebegin "Converting \"${EGIT_DIR}\" from non-bare to bare copy"
474 mv "${EGIT_DIR}/.git" "${EGIT_DIR}.bare" 488 mv "${EGIT_DIR}/.git" "${EGIT_DIR}.bare"
475 export GIT_DIR="${EGIT_DIR}.bare" 489 export GIT_DIR="${EGIT_DIR}.bare"
477 returnstate=$? 491 returnstate=$?
478 unset GIT_DIR 492 unset GIT_DIR
479 rm -rf "${EGIT_DIR}" 493 rm -rf "${EGIT_DIR}"
480 mv "${EGIT_DIR}.bare" "${EGIT_DIR}" 494 mv "${EGIT_DIR}.bare" "${EGIT_DIR}"
481 eend ${returnstate} 495 eend ${returnstate}
482 fi
483 if [[ ${target} == full && ! -d ${EGIT_DIR}/.git ]]; then 496 elif [[ ! ${bare} && ! -d ${EGIT_DIR}/.git ]]; then
484 debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to non-bare copy" 497 debug-print "${FUNCNAME}: converting \"${EGIT_DIR}\" to non-bare copy"
485 498
486 ebegin "Converting \"${EGIT_DIR}\" from bare to non-bare copy" 499 ebegin "Converting \"${EGIT_DIR}\" from bare to non-bare copy"
487 git clone -l "${EGIT_DIR}" "${EGIT_DIR}.nonbare" > /dev/null 500 git clone -l "${EGIT_DIR}" "${EGIT_DIR}.nonbare" > /dev/null
488 returnstate=$? 501 returnstate=$?
498 einfo "Migration failed, removing \"${EGIT_DIR}\" to start from scratch." 511 einfo "Migration failed, removing \"${EGIT_DIR}\" to start from scratch."
499 rm -rf "${EGIT_DIR}" 512 rm -rf "${EGIT_DIR}"
500 fi 513 fi
501 514
502 # set various options to work with both targets 515 # set various options to work with both targets
503 if [[ ${target} == bare ]]; then 516 if [[ ${bare} ]]; then
504 debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\"" 517 debug-print "${FUNCNAME}: working in bare repository for \"${EGIT_DIR}\""
505 EGIT_LOCAL_OPTIONS+="${EGIT_OPTIONS} --bare" 518 EGIT_LOCAL_OPTIONS+="${EGIT_OPTIONS} --bare"
506 MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }" 519 MOVE_COMMAND="git clone -l -s -n ${EGIT_DIR// /\\ }"
507 EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}" 520 EGIT_UPDATE_CMD="git fetch -t -f -u origin ${EGIT_BRANCH}:${EGIT_BRANCH}"
508 UPSTREAM_BRANCH="${EGIT_BRANCH}" 521 UPSTREAM_BRANCH="${EGIT_BRANCH}"
522 EGIT_LOCAL_NONBARE=
509 else 523 else
510 debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\"" 524 debug-print "${FUNCNAME}: working in bare repository for non-bare \"${EGIT_DIR}\""
511 MOVE_COMMAND="cp -pPR ." 525 MOVE_COMMAND="cp -pPR ."
512 EGIT_LOCAL_OPTIONS="${EGIT_OPTIONS}" 526 EGIT_LOCAL_OPTIONS="${EGIT_OPTIONS}"
513 EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}" 527 EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}"
515 EGIT_LOCAL_NONBARE="true" 529 EGIT_LOCAL_NONBARE="true"
516 fi 530 fi
517} 531}
518 532
519# @FUNCTION: git-2_cleanup 533# @FUNCTION: git-2_cleanup
534# @INTERNAL
520# @DESCRIPTION: 535# @DESCRIPTION:
521# Internal function cleaning up all the global variables 536# Internal function cleaning up all the global variables
522# that are not required after the unpack has been done. 537# that are not required after the unpack has been done.
523git-2_cleanup() { 538git-2_cleanup() {
524 debug-print-function ${FUNCNAME} "$@" 539 debug-print-function ${FUNCNAME} "$@"
554 git-2_cleanup 569 git-2_cleanup
555 echo ">>> Unpacked to ${EGIT_SOURCEDIR}" 570 echo ">>> Unpacked to ${EGIT_SOURCEDIR}"
556 571
557 # Users can specify some SRC_URI and we should 572 # Users can specify some SRC_URI and we should
558 # unpack the files too. 573 # unpack the files too.
559 if [[ -z ${EGIT_NOUNPACK} ]]; then 574 if [[ ! ${EGIT_NOUNPACK} ]]; then
560 if has ${EAPI:-0} 0 1; then 575 if has ${EAPI:-0} 0 1; then
561 [[ -n ${A} ]] && unpack ${A} 576 [[ ${A} ]] && unpack ${A}
562 else 577 else
563 default_src_unpack 578 default_src_unpack
564 fi 579 fi
565 fi 580 fi
566} 581}

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.20