GIT and the current -stable
Good day.
Stumbling around with git here. I'd like to use git to efficiently track the
current -stable as well as -current. Say, my local tree is a clone of
Linus current:
git clone \ git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git local
I then branch off a 2.6.20 branch:
cd local
git checkout -b v2.6.20 v2.6.20
to now update to the current -stable I could do:
git pull \ git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.20.y.git
each time that a new -stable is released. Rather though, I'd like a simple "git pull" to do this while on this branch while a "git pull" while back on the master branch pulls from the originally cloned Linus repo again.
Is this possible? Do I want it to be? Comments like "work like this instead" welcome as well; figuring out what the heck it is that I want from git seems to be one of the most difficult questions to answer...
Currently using git 1.5.0.4.
Rene.
Quoted 10 lines · Rene Herman
Stumbling around with git here. I'd like to use git to efficiently track the current -stable as well as -current. Say, my local tree is a clone of Linus current:
git clone \
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
localI then branch off a 2.6.20 branch:
Quoted 7 lines
cd local
git checkout -b v2.6.20 v2.6.20to now update to the current -stable I could do:
git pull \
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.20.y.git
I think adding these lines to .git/config would do the trick, after you have done the "checkout -b v2.6.20 v2.6.20" step:
[branch "v2.6.20"]
remote = stable
merge = refs/heads/master
[remote "stable"]
url = git://git.kernel.org/.../stable/linux-2.6.20.y.git fetch = refs/heads/master
provided if stable team forks v2.6.20.y history off of Linus's v2.6.20.
With the above configuration, anytime you say "git pull" while on your v2.6.20 branch will fetch from "stable" and merge their 'master' branch in your current branch (i.e. v2.6.20 branch).
Quoted 10 lines · Junio C Hamano
I think adding these lines to .git/config would do the trick, after you have done the "checkout -b v2.6.20 v2.6.20" step:
[branch "v2.6.20"]
remote = stable
merge = refs/heads/master
[remote "stable"]url = git://git.kernel.org/.../stable/linux-2.6.20.y.git fetch = refs/heads/master
Quoted 6 lines
provided if stable team forks v2.6.20.y history off of Linus's v2.6.20.
With the above configuration, anytime you say "git pull" while on your v2.6.20 branch will fetch from "stable" and merge their 'master' branch in your current branch (i.e. v2.6.20 branch).
Yes, this does seem to work, thanks. Was thrown of a bit by having named the branch "v2.6.20". GIT and I disagree what it is that I want to happen when I say "git checkout v2.6.20" if v2.6.20 is also a tag on master.
The pull behaviour does not follow further branches:
rene@7ixe4:~/src/linux/local$ git branch
* 2.6.20
master
rene@7ixe4:~/src/linux/local$ git checkout -b 7ixe4
Switched to a new branch "7ixe4"
rene@7ixe4:~/src/linux/local$ git pull
Warning: No merge candidate found because value of config option
"branch.7ixe4.merge" does not match any remote branch fetched.
No changes.This might in practice not be all bad in fact, and I suppose I understand how to "fix" it along the same lines as above.
But as happens very frequently with GIT, I get the feeling that I just don't understand how it's all intended to be used. It seems that what I wanted above is not standard? What would be expected use of the stable GIT repo? Just cloning that outright into another repo?
A "GIT WHYTO" from someone with the oversight would be very useful...
Rene.
Quoted 27 lines · Junio C Hamano
Quoted 10 lines · Rene Herman
Stumbling around with git here. I'd like to use git to efficiently track the current -stable as well as -current. Say, my local tree is a clone of Linus current:
git clone \
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
localI then branch off a 2.6.20 branch:
Quoted 7 lines
cd local
git checkout -b v2.6.20 v2.6.20to now update to the current -stable I could do:
git pull \
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.20.y.gitI think adding these lines to .git/config would do the trick, after you have done the "checkout -b v2.6.20 v2.6.20" step:
[branch "v2.6.20"]
remote = stable
merge = refs/heads/master
[remote "stable"]
Quoted 5 lines
url = git://git.kernel.org/.../stable/linux-2.6.20.y.git fetch = refs/heads/masterprovided if stable team forks v2.6.20.y history off of Linus's v2.6.20.
Yes, we do branch off Linus's tree for each of the different .y releases.
Some people have asked us to keep all of the different .y branches in the same git tree, but for now we have been using different repositories on kernel.org to keep things simpler for the majority of people who do not fully understand how to use the branching features of git (myself included in that category at times, I've messed up merging to different branches too many times...)
Quoted 3 lines
With the above configuration, anytime you say "git pull" while on your v2.6.20 branch will fetch from "stable" and merge their 'master' branch in your current branch (i.e. v2.6.20 branch).
That's really cool, thanks for pointing out how to do it.
thanks,
greg k-h
Quoted 7 lines · Junio C Hamano
I think adding these lines to .git/config would do the trick, after you have done the "checkout -b v2.6.20 v2.6.20" step:
[branch "v2.6.20"]
remote = stable
merge = refs/heads/master
Please don't do this. Using the same name for a branch as for a tag is madness. Call it "v2.6.20-stable" or anything else, but don't re-use the same naming as for tags.
Sure, git will have some random well-defined order of parsing which one "v2.6.20" actually means in any particular context (usually the tag-name will take precedence, except for contexts where the branchname is required!), and yeah, you can always make things unambiguous by specifying the full name (ie say "[refs/]tags/v2.6.20" when you want to make sure it's unambiguously the tag, not the branch) but it's still guaranteed to cause confusion at *some* level, if only for the user.
So just don't do it.
Linus
Quoted 4 lines
Please don't do this. Using the same name for a branch as for a tag is madness. Call it "v2.6.20-stable" or anything else, but don't re-use the same naming as for tags.
Yes I have done this before, and it took me awhile to realize what was going on. It caused me some grief, and a few hours of lost time...Of course this was back in my earlier days ;)
Quoted 9 lines · * Rene Herman ([email protected]) wrote:
Stumbling around with git here. I'd like to use git to efficiently track the current -stable as well as -current. Say, my local tree is a clone of Linus current:
git clone \
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.gitlocalI then branch off a 2.6.20 branch:
Quoted 7 lines
cd local
git checkout -b v2.6.20 v2.6.20to now update to the current -stable I could do:
git pull \
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.20.y.git
I've already put a tree like this up on kernel.org. The master branch is Linus' tree, and there's branches for each of the stable releases called linux-2.6.[12-20].y (I didn't add 2.6.11.y).
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=summary
Quoted 3 lines
each time that a new -stable is released. Rather though, I'd like a simple "git pull" to do this while on this branch while a "git pull" while back on the master branch pulls from the originally cloned Linus repo again.
You have to be careful with pull. It will always want to merge onto your current branch.
thanks,
-chris
Quoted 5 lines · Chris Wright
I've already put a tree like this up on kernel.org. The master branch is Linus' tree, and there's branches for each of the stable releases called linux-2.6.[12-20].y (I didn't add 2.6.11.y).
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=summary
I see, thank you; that sounds like a good "master" repo to clone then.
Rene.
Quoted 9 lines · Rene Herman
Quoted 5 lines · Chris Wright
I've already put a tree like this up on kernel.org. The master branch is Linus' tree, and there's branches for each of the stable releases called linux-2.6.[12-20].y (I didn't add 2.6.11.y).
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=summary
I see, thank you; that sounds like a good "master" repo to clone then.
Okay, I just cloned this repo, like:
git clone -n \git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6-stable.git \
stable
How do I now checkout for example 2.6.20.6, or get a diff between 2.6.20.6 and the (at the moment of writing latest -stable) 2.6.20.7?
rene@7ixe4:~/src/linux$ cd stable rene@7ixe4:~/src/linux/stable$ git branch -a * master origin/HEAD origin/linux-2.6 origin/linux-2.6.12.y origin/linux-2.6.13.y origin/linux-2.6.14.y origin/linux-2.6.15.y origin/linux-2.6.16.y origin/linux-2.6.17.y origin/linux-2.6.18.y origin/linux-2.6.19.y origin/linux-2.6.20.y origin/master
and I can check them out like
rene@7ixe4:~/src/linux/stable$ git checkout origin/linux-2.6.20.y
or in this case, but only this case, like:
rene@7ixe4:~/src/linux/stable$ git checkout v2.6.20.7
"v2.6.20.7" seems to be the only tag from the stable branches that's present
in this tree?
rene@7ixe4:[...]$ git tag -l | grep "v2\.6\.[[:digit:]]\{1,2\}\."
v2.6.20.7Rene.
Quoted 6 lines · Rene Herman
"v2.6.20.7" seems to be the only tag from the stable branches that's present
in this tree?rene@7ixe4:[...]$ git tag -l | grep "v2\.6\.[[:digit:]]\{1,2\}\." v2.6.20.7
Obviously I don't know how Chris created his conglomerated repo, but I just made one of my own, and it has all the tags I would expect in it ... so it's not an inherent git problem (or not in 1.5.1.1 anyway).
I guess that Chris created his in such a way that the automated tag following code didn't trigger? (Or maybe used a really old git?)
(Mine's at http://git.q42.co.uk/w/stable.git if anyone is interested enough to want to look at it ...)
It only took me 4 commands to create too (ok, so three of them were bash for loops ... and I did do a little bit more to tidy up), I do enjoy using flexible tools :D.
Signature · 6 lines
Julian --- Go slowly to the entertainments of thy friends, but quickly to their misfortunes. -- Chilo
Quoted 5 lines · Chris Wright
I've already put a tree like this up on kernel.org. The master branch is Linus' tree, and there's branches for each of the stable releases called linux-2.6.[12-20].y (I didn't add 2.6.11.y).
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=summary
Is HEAD for that repo the most recent stable branch, or (as gitweb makes it look) Linus's head. I'd expect a "-stable" repo to point at the most recent stable commit, not the most recent development commit. And I'd also expect gitweb's summary page to show the shortlog for HEAd. One of my assumptions are being broken and I don't like it. It leaves me all confused...
(I'd just clone your repo and look for myself, but I'm still pulling Linus's tree for the first time and I don't have a fast connection.)
~~ Brian
Quoted 5 lines · * Brian Gernhardt ([email protected]) wrote:
Quoted 4 lines · Chris Wright
I've already put a tree like this up on kernel.org. The master branch is Linus' tree, and there's branches for each of the stable releases called linux-2.6.[12-20].y (I didn't add 2.6.11.y).
Quoted 8 lines
Is HEAD for that repo the most recent stable branch, or (as gitweb makes it look) Linus's head. I'd expect a "-stable" repo to point at the most recent stable commit, not the most recent development commit. And I'd also expect gitweb's summary page to show the shortlog for HEAd. One of my assumptions are being broken and I don't like it. It leaves me all confused...
As I mentioned. The master branch (HEAD) is Linus' tree, and each stable tree is on its own branch. You'll find shortlog summarizes the main branch, so yes, gitweb's summary is a bit confusing based on your assumptions. This is a new tree and hasn't been publicized until now. It does make sense to have its head be the newest stable, I'll switch that around.
thanks,
-chris
Quoted 2 lines · Chris Wright
As I mentioned. The master branch (HEAD) is Linus' tree, and each stable tree is on its own branch.
Hm. I should drink my coffee, then read the mailing list, not the other way around. If you do update HEAD to be the most recent stable, my thanks. Apologies for the noise.
~~ Brian
Quoted 3 lines · * Brian Gernhardt ([email protected]) wrote:
Hm. I should drink my coffee, then read the mailing list, not the other way around. If you do update HEAD to be the most recent stable, my thanks. Apologies for the noise.
No problem, was a good suggestion (and it's done).
thanks,
-chris
Quoted 15 lines · Chris Wright
Quoted 5 lines · * Brian Gernhardt ([email protected]) wrote:
Quoted 4 lines · Chris Wright
I've already put a tree like this up on kernel.org. The master branch is Linus' tree, and there's branches for each of the stable releases called linux-2.6.[12-20].y (I didn't add 2.6.11.y).
Quoted 8 lines
Is HEAD for that repo the most recent stable branch, or (as gitweb makes it look) Linus's head. I'd expect a "-stable" repo to point at the most recent stable commit, not the most recent development commit. And I'd also expect gitweb's summary page to show the shortlog for HEAd. One of my assumptions are being broken and I don't like it. It leaves me all confused...
Quoted 6 lines
As I mentioned. The master branch (HEAD) is Linus' tree, and each stable tree is on its own branch. You'll find shortlog summarizes the main branch, so yes, gitweb's summary is a bit confusing based on your assumptions. This is a new tree and hasn't been publicized until now. It does make sense to have its head be the newest stable, I'll switch that around.
Would it not make more sense to point HEAD at the linux-2.6.20-y branch and either let master be Linus' tree or simply not have a master branch? Otherwise, what happens to master when the latest stable tree becomes linux-2.6.21-y?
Signature · 5 lines
Julian --- Most people want either less corruption or more of a chance to participate in it.
Hello Rene,
Quoted 7 lines · Rene Herman
each time that a new -stable is released. Rather though, I'd like a simple "git pull" to do this while on this branch while a "git pull" while back on the master branch pulls from the originally cloned Linus repo again.
Is this possible? Do I want it to be? Comments like "work like this instead" welcome as well; figuring out what the heck it is that I want from git seems to be one of the most difficult questions to answer...
Chris' mail made that somehow superfluous but anyhow. I have a Python script to update my Linux tree. It's attached.
It automatically addsgit://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.x.y as a remote as soon as v2.6.x is seen in Linus' repo and then fetches 2.6.16, 2.6.(last - 1) and 2.6.last. If you want to fetch all, change
for stable in (16, last_stable - 1, last_stable):
in
for stable in xrange(16, last_stable + 1):
The location of the repo is hardcoded to $HOME/gsrc/linux-2.6, but I think everyone with a bit of intuition should be able to change that ...
So it's not a "git pull" for me, but "update-linux".
Best regards
Uwe
Signature · 4 lines
Uwe Kleine-König
main(){char*a="main(){char*a=%c%s%c;printf(a,34,a,34%c";printf(a,34,a,34
,10);a=",10);a=%c%s%c;printf(a,34,a,34,10);}%c";printf(a,34,a,34,10);}#! /usr/bin/env python
import os, re, subprocess, sys
silent = False
git_dir = os.path.join(os.getenv('HOME'), 'gsrc', 'linux-2.6', '.git') os.putenv('GIT_DIR', git_dir)
devnull = open('/dev/null', 'w', 0)
if silent:
subprocess_stdout = devnull
else:
subprocess_stdout = None
if not silent:
print 'fetch origin'subprocess.call(['git-fetch', 'origin'], stdout=subprocess_stdout)
sp_describe = subprocess.Popen(['git-describe', 'origin'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) sp_describe_stdin, sp_describe_stderr = sp_describe.communicate()
re_linuxver = re.compile('v2\.6\.(?P<minor>\d+)(?P<stable>\.\d+)?(?P<rc>-rc\d+)?(?P<git>-g[0-9a-fA-F]+)?') mo = re_linuxver.match(sp_describe_stdin)
if not mo:
print 'cannot parse version of origin\'s HEAD'
sys.exit(1)
modict = mo.groupdict()
if modict['rc'] and not modict['stable']:
last_stable = int(modict['minor']) - 1
else:
last_stable = int(modict['minor'])
for stable in (16, last_stable - 1, last_stable):
if subprocess.call(['git', 'repo-config', 'remote.v2.6.%d.y.url' % stable], stdout=devnull) != 0:
subprocess.call(['git', 'repo-config', 'remote.v2.6.%d.y.url' % stable, 'git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.%d.y.git' % stable])
subprocess.call(['git', 'repo-config', 'remote.v2.6.%d.y.fetch' % stable, 'refs/heads/master:refs/remotes/stable/v2.6.%d.y' % stable])
subprocess.call(['git', 'repo-config', 'branch.v2.6.%d.y.remote' % stable, 'v2.6.%d.y' % stable])
subprocess.call(['git', 'repo-config', 'branch.v2.6.%d.y.remote' % stable, 'v2.6.%d.y' % stable])
subprocess.call(['git', 'repo-config', 'branch.v2.6.%d.y.merge' % stable, 'refs/heads/master'])if not silent:
print 'fetch v2.6.%d.y' % stable
subprocess.call(['git-fetch', 'v2.6.%d.y' % stable], stdout=subprocess_stdout)