Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 370920 Details for
Bug 489100
git-r3.eclass: support 'git rev-parse HEAD', 'git describe', and 'git log -1 HEAD'
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch 3.
0003-Clone-the-repository-into-working-directory.patch (text/plain), 4.15 KB, created by
Michał Górny
on 2014-02-20 23:32:51 UTC
(
hide
)
Description:
Patch 3.
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2014-02-20 23:32:51 UTC
Size:
4.15 KB
patch
obsolete
>From 07e8552a3ec20b54ee5537ebaeb05217e4ed4d40 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> >Date: Fri, 21 Feb 2014 00:30:34 +0100 >Subject: [PATCH 3/3] Clone the repository into working directory. > >This should fix most of the issues weird build systems have. Not all >possible -- e.g. they still can't know what branch is it -- but it's >a good step ahead. >--- > eclass/git-r3.eclass | 60 +++++++++++++++++++++------------------------------- > 1 file changed, 24 insertions(+), 36 deletions(-) > >diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass >index fb75cff..fd3610d 100644 >--- a/eclass/git-r3.eclass >+++ b/eclass/git-r3.eclass >@@ -410,53 +410,46 @@ git-r3_checkout() { > local out_dir=${2:-${EGIT_CHECKOUT_DIR:-${WORKDIR}/${P}}} > local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}} > >- local -x GIT_DIR GIT_WORK_TREE >+ local -x GIT_DIR > _git-r3_set_gitdir "${repos[0]}" >- GIT_WORK_TREE=${out_dir} >- mkdir -p "${GIT_WORK_TREE}" || die > > einfo "Checking out ${repos[0]} to ${out_dir} ..." > >- if ! git cat-file -e refs/git-r3/"${local_id}"/__main__ >- then >+ if ! git cat-file -e refs/git-r3/"${local_id}"/__main__; then > if [[ ${EVCS_OFFLINE} ]]; then > die "No local clone of ${repos[0]}. Unable to work with EVCS_OFFLINE." > else > die "Logic error: no local clone of ${repos[0]}. git-r3_fetch not used?" > fi > fi >+ local new_commit_id=$( >+ git rev-parse --verify refs/git-r3/"${local_id}"/__main__ >+ ) > >- # Note: this is a hack to avoid parallel checkout issues. >- # I will try to handle it without locks when I have more time. >- local lockfile=${GIT_DIR}/.git-r3_checkout_lock >- local lockfile_l=${lockfile}.${BASHPID} >- touch "${lockfile_l}" || die >- until ln "${lockfile_l}" "${lockfile}" &>/dev/null; do >- sleep 1 >- done >- rm "${lockfile_l}" || die >- >- set -- git checkout -f refs/git-r3/"${local_id}"/__main__ . >+ set -- git clone --shared --no-checkout "${GIT_DIR}" "${out_dir}"/ > echo "${@}" >&2 >- "${@}" >- local ret=${?} >- >- # Remove the lock! >- rm "${lockfile}" || die >+ "${@}" || die "git clone (for checkout) failed" > >- [[ ${ret} == 0 ]] || die "git checkout refs/git-r3/${local_id}/__main__ failed" >+ git-r3_sub_checkout() { >+ local -x GIT_DIR=${out_dir}/.git >+ local -x GIT_WORK_TREE=${out_dir} > >- # diff against previous revision (if any) >- local new_commit_id=$(git rev-parse --verify refs/git-r3/"${local_id}"/__main__) >- local old_commit_id=$( >- git rev-parse --verify refs/git-r3/"${local_id}"/__old__ 2>/dev/null >- ) >+ set -- git checkout --quiet "${new_commit_id}" >+ echo "${@}" >&2 >+ "${@}" || die "git checkout ${new_commit_id} failed" >+ } >+ git-r3_sub_checkout > >- if [[ ! ${old_commit_id} ]]; then >+ if ! git cat-file -e refs/git-r3/"${local_id}"/__old__; then > echo "GIT NEW branch -->" > echo " repository: ${repos[0]}" > echo " at the commit: ${new_commit_id}" > else >+ # diff against previous revision >+ local old_commit_id=$( >+ git rev-parse --verify refs/git-r3/"${local_id}"/__old__ 2>/dev/null >+ ) >+ > echo "GIT update -->" > echo " repository: ${repos[0]}" > # write out message based on the revisions >@@ -473,10 +466,10 @@ git-r3_checkout() { > git update-ref refs/git-r3/"${local_id}"/{__old__,__main__} || die > > # recursively checkout submodules >- if [[ -f ${GIT_WORK_TREE}/.gitmodules ]]; then >+ if [[ -f ${out_dir}/.gitmodules ]]; then > local submodules > _git-r3_set_submodules \ >- "$(<"${GIT_WORK_TREE}"/.gitmodules)" >+ "$(<"${out_dir}"/.gitmodules)" > > while [[ ${submodules[@]} ]]; do > local subname=${submodules[0]} >@@ -487,7 +480,7 @@ git-r3_checkout() { > url=${repos[0]%%/}/${url} > fi > >- git-r3_checkout "${url}" "${GIT_WORK_TREE}/${path}" \ >+ git-r3_checkout "${url}" "${out_dir}/${path}" \ > "${local_id}/${subname}" > > submodules=( "${submodules[@]:3}" ) # shift >@@ -497,11 +490,6 @@ git-r3_checkout() { > # keep this *after* submodules > export EGIT_DIR=${GIT_DIR} > export EGIT_VERSION=${new_commit_id} >- >- # create a fake '.git' directory to satisfy 'git rev-parse HEAD' >- GIT_DIR=${GIT_WORK_TREE}/.git >- git init || die >- echo "${EGIT_VERSION}" > "${GIT_WORK_TREE}"/.git/HEAD || die > } > > # @FUNCTION: git-r3_peek_remote_ref >-- >1.9.0 >
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 489100
:
370916
|
370918
| 370920 |
370968