Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 558374

Summary: git-2 eclass doesn't properly handle nonbare repos that rebase
Product: Gentoo Linux Reporter: James Ausmus <james.ausmus>
Component: EclassesAssignee: Michał Górny <mgorny>
Status: RESOLVED OBSOLETE    
Severity: normal CC: alunduil, dberkholz
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch to add an EGIT_FORCE_FETCH_UPDATE variable

Description James Ausmus 2015-08-21 22:52:49 UTC
The git-2 eclass doesn't properly handle a nonbare repo and an origin that does significant rebases. The git-2_update_repo function calls EGIT_UPDATE_CMD - for  a nonbare repo, EGIT_UPDATE_CMD="git pull -f -u ${EGIT_OPTIONS}" - git pull -f -u doesn't handle very well the case where the remote has been rebased with commits that conflict with commits currently checked out in the nonbare repo.

Reproducible: Always

Steps to Reproduce:
1. Create a git repo with some commits
2. Set up an ebuild to use git-2 to clone it in nonbare mode
3. Get through git-2_src_unpack once
4. Rebase the git repo with commits that will conflict with the previous checkout
5. Run git-2_src_unpack again

Actual Results:  
Something along the lines of:

Already on 'master'                                                                                                                   
Your branch and 'origin/master' have diverged,                                                                                        
and have 22 and 32 different commits each, respectively.                                                                              
  (use "git pull" to merge the remote branch into yours)                                                                              
 * egit_up: git pull -f -u                                                                                                            
warning: inexact rename detection was skipped due to too many files.                                                                  
warning: you may want to set your merge.renamelimit variable to at least 7423 and retry the command.                                  
 * ERROR: foo-bar/my-ebuild-9999 failed (unpack phase):
 *   git-2_update_repo: can't update from git://my-project

Expected Results:  
git-2 should have an option to fetch and checkout, rather than pulling
Comment 1 James Ausmus 2015-08-22 00:30:37 UTC
Created attachment 409794 [details, diff]
Patch to add an EGIT_FORCE_FETCH_UPDATE variable

Adds an EGIT_FORCE_FETCH_UPDATE variable to git-2.eclass, which, when set, forces git-2 to use git fetch for git-2_update_repo
Comment 2 Alex Brandt (RETIRED) gentoo-dev 2015-08-22 02:54:58 UTC
Would it be better to verify this also affects git-r3.eclass and upgrade offending ebuilds?  Just asking as I'm curious.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-08-27 18:59:58 UTC
This eclass is deprecated. I don't think we'd be adding more code for the non-bare mode since it's gone in git-r3.
Comment 4 Alex Brandt (RETIRED) gentoo-dev 2015-08-30 03:52:18 UTC
Should this bug be closed and a tracker created to migrate ebuilds to git-r3.eclass?  Is the non-bare mode still a requirement for certain ebuilds?  Again, just asking to keep this moving towards resolution.
Comment 5 James Ausmus 2015-08-31 21:28:30 UTC
I have a personal use case where I need a non-bare repository (need to be able to, in the ebuild, merge topic branches from a second repository on to the checkout from the EGIT-managed repository)
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-12-21 13:45:15 UTC
git-2.eclass is long gone.