Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 489100 | Differences between
and this patch

Collapse All | Expand All

(-)a/eclass/git-r3.eclass (-22 / +9 lines)
Lines 312-318 git-r3_fetch() { Link Here
312
	local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}}
312
	local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}}
313
	local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}}
313
	local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}}
314
	local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}}
314
	local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}}
315
	local local_ref=refs/heads/${local_id}/__main__
315
	local local_ref=refs/git-r3/${local_id}/__main__
316
316
317
	[[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset"
317
	[[ ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset"
318
318
Lines 324-340 git-r3_fetch() { Link Here
324
	for r in "${repos[@]}"; do
324
	for r in "${repos[@]}"; do
325
		einfo "Fetching ${remote_ref} from ${r} ..."
325
		einfo "Fetching ${remote_ref} from ${r} ..."
326
326
327
		local lookup_ref
328
		if [[ ${remote_ref} == refs/heads/* || ${remote_ref} == HEAD ]]
329
		then
330
			is_branch=1
331
			lookup_ref=${remote_ref}
332
		else
333
			# ls-remote by commit is going to fail anyway,
334
			# so we may as well pass refs/tags/ABCDEF...
335
			lookup_ref=refs/tags/${remote_ref}
336
		fi
337
338
		local fetch_command=(
327
		local fetch_command=(
339
			git fetch --prune "${r}"
328
			git fetch --prune "${r}"
340
			# mirror the remote branches as local branches
329
			# mirror the remote branches as local branches
Lines 346-356 git-r3_fetch() { Link Here
346
		set -- "${fetch_command[@]}"
335
		set -- "${fetch_command[@]}"
347
		echo "${@}" >&2
336
		echo "${@}" >&2
348
		if "${@}"; then
337
		if "${@}"; then
349
			set -- git branch -f "${local_id}/__main__" \
338
			set -- git update-ref "${local_ref}" "${remote_ref}"
350
				"${ref[0]:-${remote_ref}}"
351
			echo "${@}" >&2
339
			echo "${@}" >&2
352
			if ! "${@}"; then
340
			if ! "${@}"; then
353
				die "Creating branch for ${remote_ref} failed (wrong ref?)."
341
				die "Referencing ${remote_ref} failed (wrong ref?)."
354
			fi
342
			fi
355
343
356
			success=1
344
			success=1
Lines 429-435 git-r3_checkout() { Link Here
429
417
430
	einfo "Checking out ${repos[0]} to ${out_dir} ..."
418
	einfo "Checking out ${repos[0]} to ${out_dir} ..."
431
419
432
	if ! git cat-file -e refs/heads/"${local_id}"/__main__
420
	if ! git cat-file -e refs/git-r3/"${local_id}"/__main__
433
	then
421
	then
434
		if [[ ${EVCS_OFFLINE} ]]; then
422
		if [[ ${EVCS_OFFLINE} ]]; then
435
			die "No local clone of ${repos[0]}. Unable to work with EVCS_OFFLINE."
423
			die "No local clone of ${repos[0]}. Unable to work with EVCS_OFFLINE."
Lines 448-454 git-r3_checkout() { Link Here
448
	done
436
	done
449
	rm "${lockfile_l}" || die
437
	rm "${lockfile_l}" || die
450
438
451
	set -- git checkout -f "${local_id}"/__main__ .
439
	set -- git checkout -f refs/git-r3/"${local_id}"/__main__ .
452
	echo "${@}" >&2
440
	echo "${@}" >&2
453
	"${@}"
441
	"${@}"
454
	local ret=${?}
442
	local ret=${?}
Lines 456-467 git-r3_checkout() { Link Here
456
	# Remove the lock!
444
	# Remove the lock!
457
	rm "${lockfile}" || die
445
	rm "${lockfile}" || die
458
446
459
	[[ ${ret} == 0 ]] || die "git checkout ${local_id}/__main__ failed"
447
	[[ ${ret} == 0 ]] || die "git checkout refs/git-r3/${local_id}/__main__ failed"
460
448
461
	# diff against previous revision (if any)
449
	# diff against previous revision (if any)
462
	local new_commit_id=$(git rev-parse --verify "${local_id}"/__main__)
450
	local new_commit_id=$(git rev-parse --verify refs/git-r3/"${local_id}"/__main__)
463
	local old_commit_id=$(
451
	local old_commit_id=$(
464
		git rev-parse --verify "${local_id}"/__old__ 2>/dev/null
452
		git rev-parse --verify refs/git-r3/"${local_id}"/__old__ 2>/dev/null
465
	)
453
	)
466
454
467
	if [[ ! ${old_commit_id} ]]; then
455
	if [[ ! ${old_commit_id} ]]; then
Lines 482-488 git-r3_checkout() { Link Here
482
			echo "   at the commit:            ${new_commit_id}"
470
			echo "   at the commit:            ${new_commit_id}"
483
		fi
471
		fi
484
	fi
472
	fi
485
	git branch -f "${local_id}"/{__old__,__main__} || die
473
	git update-ref refs/git-r3/"${local_id}"/{__old__,__main__} || die
486
474
487
	# recursively checkout submodules
475
	# recursively checkout submodules
488
	if [[ -f ${GIT_WORK_TREE}/.gitmodules ]]; then
476
	if [[ -f ${GIT_WORK_TREE}/.gitmodules ]]; then
489
- 

Return to bug 489100