[v2] contrib: New remotes structure for vendor and personal refs

Richard Earnshaw (lists) Richard.Earnshaw@arm.com
Tue Jan 21 10:54:00 GMT 2020


On 21/01/2020 01:47, Hans-Peter Nilsson wrote:
>> From: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>
>> Date: Fri, 17 Jan 2020 12:21:07 +0100
> 
>> As far as possible, I've made the script automatically restructure any
>> existing fetch or push lines that earlier versions of the scripts may
>> have created - the gcc-git-customization.sh script will convert all
>> vendor refs that it can find, so it is not necessary to re-add any
>> vendors you've already added.
> 
> I fail, using these instructions, trying to create a
> vendor-branch named axis/cris-decc0, using git-2.11.0 from
> Debian 9.
> 
>> You might, however, want to run
>>     git remote prune <origin>
>> after running to clean up any stale upstream-refs that might still be in
>> your local repo, and then
>>     git fetch vendors/<vendor>
>> or
>>     git fetch <me>
>> to re-populate the remotes/ structures.
> 
> (I did not use gcc-git-customization.sh or git-fetch-vendor.sh before
> XXXXXX, so there's presumably nothing to clean up.)
> 
> I've done
> $ ./contrib/gcc-git-customization.sh
> and
> $ ./contrib/git-fetch-vendor.sh --enable-push axis
> 
>> Also, for any branch you already have that tracks a personal or vendor
>> branch upstream, you might need to run
>>     git config branch.<name>.remote <new-remote>
>>
>> so that merges and pushes go to the right place (I haven't attempted to
>> automate this last part).
>>
>> For vendors, the new structure means that
>>
>>     git checkout -b <vendor>/<branch> remotes/vendors/<vendor>/<branch>
>>
>> will correctly set up a remote tracking branch.
> 
> On master, doing
> 
> $ git checkout -b axis/cris-decc0 remotes/vendors/axis/cris-decc0
> fatal: Cannot update paths and switch to branch 'axis/cris-decc0' at the same time.
> Did you intend to checkout 'remotes/vendors/axis/cris-decc0' which can not be resolved as commit?
> 

It's nothing to do with setting up your vendors space, but a consequence 
that you can't track a remote branch that hasn't been created yet; 
you'll see the same thing even for personal branches or for other new 
vendor branches.  I'll need to document that.

Initially, you'll need to create the upstream branch, something like 
(but untested).

# Set up axis vendor area
contrib/git-fetch-vendor.sh --enable-push axis
# Using master, or some other branch you want to base this on.
git checkout -b axis/cris-decc0 master
# create upstream
git push vendors/axis axis/cris-decc0:refs/vendors/axis/heads/cris-decc0

(In theory, you should be able to add '-u' to the above, but 
unfortunately, that doesn't work.  So, after the above)

# re-fetch the new branch
git fetch vendors/asis
git branch --set-upstream remotes/vendors/axis/cris-decc0

Now things should push and pull properly.

> My .git/config looks like this after the gcc-descr and
> gcc-undescr lines:
> 
> [diff "md"]
> 	xfuncname = ^\\(define.*$
> [gcc-config]
> 	upstream = origin
> 	user = hp
> 	userpfx = me
> [remote "me"]
> 	url = git+ssh://gcc.gnu.org/git/gcc.git
> 	fetch = +refs/users/hp/heads/*:refs/remotes/me/*
> 	fetch = +refs/users/hp/tags/*:refs/tags/me/*
> 	push = refs/heads/me/*:refs/users/hp/heads/*
> [remote "vendors/axis"]
> 	url = git+ssh://gcc.gnu.org/git/gcc.git
> 	fetch = +refs/vendors/axis/heads/*:refs/remotes/vendors/axis/*
> 	fetch = +refs/vendors/axis/tags/*:refs/tags/vendors/axis/*
> 	push = refs/heads/axis/*:refs/vendors/axis/heads/*
> 
> Bug in script (undiscovered because e.g. everybody else uses an
> existing vendor or branch) or PEBKAC?
> 
> I'm past git 101, maybe even intermediate, for some definition
> thereof, but this refs-configury is way beyond my
> error-correction capabilities; I can't tell typos.
> 
> I'm about to create a devel/ branch instead, as that seems way
> simpler than playing hide-and-seek like this, but that will make
> everyone else fetch an additional blob that may be several
> kilobytes (compressed).  Probably much larger than this email. :)
> 
> brgds, H-P
> 

Hope that helps,

R.



More information about the Gcc-patches mailing list