Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 386010 Details for
Bug 524146
git-r3.eclass unable to find a matching branch for remote HEAD
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-Remove-unnecessary-HEAD-branch-mapping-code.patch (text/plain), 3.53 KB, created by
Michał Górny
on 2014-10-03 21:25:22 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2014-10-03 21:25:22 UTC
Size:
3.53 KB
patch
obsolete
>From a24e2991e687d31e55fd48b9b825d636e7645092 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> >Date: Fri, 3 Oct 2014 23:19:39 +0200 >Subject: [PATCH] Remove unnecessary HEAD->branch mapping code > >Remove the code responsible for recognizing which branch HEAD pointed >out to since it was unsafe and unnecessarily complex. A proper match is >not really necessary since all operations can be safely performed on >an opaque 'HEAD' (or rather refs/git-r3/HEAD since fetching to HEAD >directly breaks git a bit). >--- > eclass/git-r3.eclass | 62 ++++------------------------------------------------ > 1 file changed, 4 insertions(+), 58 deletions(-) > >diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass >index 51f0ae5..e38284e 100644 >--- a/eclass/git-r3.eclass >+++ b/eclass/git-r3.eclass >@@ -410,42 +410,6 @@ _git-r3_is_local_repo() { > [[ ${uri} == file://* || ${uri} == /* ]] > } > >-# @FUNCTION: _git-r3_find_head >-# @USAGE: <head-ref> >-# @INTERNAL >-# @DESCRIPTION: >-# Given a ref to which remote HEAD was fetched, try to find >-# a branch matching the commit. Expects 'git show-ref' >-# or 'git ls-remote' output on stdin. >-_git-r3_find_head() { >- debug-print-function ${FUNCNAME} "$@" >- >- local head_ref=${1} >- local head_hash=$(git rev-parse --verify "${1}" || die) >- local matching_ref >- >- # TODO: some transports support peeking at symbolic remote refs >- # find a way to use that rather than guessing >- >- # (based on guess_remote_head() in git-1.9.0/remote.c) >- local h ref >- while read h ref; do >- # look for matching head >- if [[ ${h} == ${head_hash} ]]; then >- # either take the first matching ref, or master if it is there >- if [[ ! ${matching_ref} || ${ref} == refs/heads/master ]]; then >- matching_ref=${ref} >- fi >- fi >- done >- >- if [[ ! ${matching_ref} ]]; then >- die "Unable to find a matching branch for remote HEAD (${head_hash})" >- fi >- >- echo "${matching_ref}" >-} >- > # @FUNCTION: git-r3_fetch > # @USAGE: [<repo-uri> [<remote-ref> [<local-id>]]] > # @DESCRIPTION: >@@ -623,26 +587,10 @@ git-r3_fetch() { > set -- "${fetch_command[@]}" > echo "${@}" >&2 > if "${@}"; then >- if [[ ${clone_type} == mirror ]]; then >- # find remote HEAD and update our HEAD properly >- git symbolic-ref HEAD \ >- "$(_git-r3_find_head refs/git-r3/HEAD \ >- < <(git show-ref --heads || die))" \ >- || die "Unable to update HEAD" >- else # single or shallow >- if [[ ${fetch_l} == HEAD ]]; then >- # find out what branch we fetched as HEAD >- local head_branch=$(_git-r3_find_head \ >- refs/git-r3/HEAD \ >- < <(git ls-remote --heads "${r}" || die)) >- >- # and move it to its regular place >- git update-ref --no-deref "${head_branch}" \ >- refs/git-r3/HEAD \ >- || die "Unable to sync HEAD branch ${head_branch}" >- git symbolic-ref HEAD "${head_branch}" \ >+ if [[ ${clone_type} == mirror || ${fetch_l} == HEAD ]]; then >+ # update our HEAD to match our remote HEAD ref >+ git symbolic-ref HEAD refs/git-r3/HEAD \ > || die "Unable to update HEAD" >- fi > fi > > # now let's see what the user wants from us >@@ -768,9 +716,7 @@ git-r3_checkout() { > # setup 'alternates' to avoid copying objects > echo "${orig_repo}/objects" > "${GIT_DIR}"/objects/info/alternates || die > # now copy the refs >- # [htn]* safely catches heads, tags, notes without complaining >- # on non-existing ones, and omits internal 'git-r3' ref >- cp -R "${orig_repo}"/refs/[htn]* "${GIT_DIR}"/refs/ || die >+ cp -R "${orig_repo}"/refs/* "${GIT_DIR}"/refs/ || die > > # (no need to copy HEAD, we will set it via checkout) > >-- >2.1.2 >
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 524146
: 386010