FYI: git worktrees as replacement for "rsync the CVSROOT"

Started by Jim Nasbyalmost 9 years ago7 messages
#1Jim Nasby
Jim.Nasby@BlueTreble.com

Not sure how many people still use [1], as referenced by our git
wiki[2], but it appears git worktrees are a viable replacement for that
technique. In short, if you're already in your checkout:

git worktree add ../9.6 REL9_6_STABLE

would give you a checkout of 9.6 in the ../9.6 directory.

BTW, I learned about this from this "git year in review" article[3].

1:
/messages/by-id/20090602162347.GF23972@yugib.highrise.ca
2:
https://wiki.postgresql.org/wiki/Working_with_Git#Continuing_the_.22rsync_the_CVSROOT.22_workflow
3:
https://hackernoon.com/git-in-2016-fad96ae22a15?imm_mid=0ec3e0&cmp=em-prog-na-na-newsltr_20170114#.shgj609ad
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Bruce Momjian
bruce@momjian.us
In reply to: Jim Nasby (#1)
Re: FYI: git worktrees as replacement for "rsync the CVSROOT"

On Sun, Jan 15, 2017 at 03:01:47PM -0600, Jim Nasby wrote:

Not sure how many people still use [1], as referenced by our git wiki[2],
but it appears git worktrees are a viable replacement for that technique. In
short, if you're already in your checkout:

git worktree add ../9.6 REL9_6_STABLE

would give you a checkout of 9.6 in the ../9.6 directory.

BTW, I learned about this from this "git year in review" article[3].

1: /messages/by-id/20090602162347.GF23972@yugib.highrise.ca
2: https://wiki.postgresql.org/wiki/Working_with_Git#Continuing_the_.22rsync_the_CVSROOT.22_workflow
3: https://hackernoon.com/git-in-2016-fad96ae22a15?imm_mid=0ec3e0&cmp=em-prog-na-na-newsltr_20170114#.shgj609ad

Uh, I don't see this in git 2.1.4:

$ git worktree
git: 'worktree' is not a git command. See 'git --help'.

which is in Debian Jessie. This reports worktree was added in 2.5,
released in July 2015:

https://developer.atlassian.com/blog/2015/10/cool-features-git-2.x/

I am glad the git team has seen the value in work trees and it will be
good to use a more officially supported method in the future.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Noname
ilmari@ilmari.org
In reply to: Bruce Momjian (#2)
Re: FYI: git worktrees as replacement for "rsync the CVSROOT"

Bruce Momjian <bruce@momjian.us> writes:

On Sun, Jan 15, 2017 at 03:01:47PM -0600, Jim Nasby wrote:

Not sure how many people still use [1], as referenced by our git wiki[2],
but it appears git worktrees are a viable replacement for that technique. In
short, if you're already in your checkout:

git worktree add ../9.6 REL9_6_STABLE

would give you a checkout of 9.6 in the ../9.6 directory.

BTW, I learned about this from this "git year in review" article[3].

1: /messages/by-id/20090602162347.GF23972@yugib.highrise.ca
2: https://wiki.postgresql.org/wiki/Working_with_Git#Continuing_the_.22rsync_the_CVSROOT.22_workflow
3: https://hackernoon.com/git-in-2016-fad96ae22a15?imm_mid=0ec3e0&amp;cmp=em-prog-na-na-newsltr_20170114#.shgj609ad

Uh, I don't see this in git 2.1.4:

$ git worktree
git: 'worktree' is not a git command. See 'git --help'.

which is in Debian Jessie. This reports worktree was added in 2.5,
released in July 2015:

Backports has git 2.11.0. Just add the "jessie-backports" suite to your
sources list, e.g.:

deb http://ftp.&lt;country&gt;.debian.org/debian/ jessie-backports main

And install git from there:

sudo apt install git/jessie-backports

Apt won't upgrade other packages to backports versions, but any packages
you've manually installed from there will be kept up-to-date.

See https://backports.debian.org/ for more details.

--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Craig Ringer
craig@2ndquadrant.com
In reply to: Jim Nasby (#1)
Re: FYI: git worktrees as replacement for "rsync the CVSROOT"

On 16 January 2017 at 05:01, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:

Not sure how many people still use [1], as referenced by our git wiki[2],
but it appears git worktrees are a viable replacement for that technique. In
short, if you're already in your checkout:

git worktree add ../9.6 REL9_6_STABLE

would give you a checkout of 9.6 in the ../9.6 directory.

BTW, I learned about this from this "git year in review" article[3].

Looks handy enough to merit adding to the Pg developer FAQ. Please?

It looks cleaner than my current approach of doing a local clone or
re-cloning from upstream with a local repo as a --reference .

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#5Andrew Dunstan
andrew.dunstan@2ndquadrant.com
In reply to: Craig Ringer (#4)
Re: FYI: git worktrees as replacement for "rsync the CVSROOT"

On 02/24/2017 02:36 AM, Craig Ringer wrote:

On 16 January 2017 at 05:01, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:

Not sure how many people still use [1], as referenced by our git wiki[2],
but it appears git worktrees are a viable replacement for that technique. In
short, if you're already in your checkout:

git worktree add ../9.6 REL9_6_STABLE

would give you a checkout of 9.6 in the ../9.6 directory.

BTW, I learned about this from this "git year in review" article[3].

Looks handy enough to merit adding to the Pg developer FAQ. Please?

It looks cleaner than my current approach of doing a local clone or
re-cloning from upstream with a local repo as a --reference .

Does this do anythng different from the git contrib script
git-new-workdir that I have been using for quite a long while?
Essentially it symlinks a bunch of things from the old workdir to the
new one. I copied the technique in the buildfarm's git_use_workdirs feature.

cheers

andrew

--

Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#5)
Re: FYI: git worktrees as replacement for "rsync the CVSROOT"

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:

On 02/24/2017 02:36 AM, Craig Ringer wrote:

On 16 January 2017 at 05:01, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:

git worktree add ../9.6 REL9_6_STABLE

Does this do anythng different from the git contrib script
git-new-workdir that I have been using for quite a long while?

I think it's basically a more formally supported version of the contrib
script. They may have fixed some of the hackier aspects of the contrib
script --- I mind in particular the fact that you need to disable git's
auto-gc activity when you use git-new-workdir, but I don't see any such
restriction in the git-worktree man page.

Haven't tried to switch over myself, but maybe I will at some point.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#7Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Tom Lane (#6)
1 attachment(s)
Re: FYI: git worktrees as replacement for "rsync the CVSROOT"

On 2/24/17 10:24 AM, Tom Lane wrote:

Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:

On 02/24/2017 02:36 AM, Craig Ringer wrote:

On 16 January 2017 at 05:01, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:

git worktree add ../9.6 REL9_6_STABLE

Does this do anythng different from the git contrib script
git-new-workdir that I have been using for quite a long while?

I think it's basically a more formally supported version of the contrib
script. They may have fixed some of the hackier aspects of the contrib
script --- I mind in particular the fact that you need to disable git's
auto-gc activity when you use git-new-workdir, but I don't see any such
restriction in the git-worktree man page.

Haven't tried to switch over myself, but maybe I will at some point.

One thing to be aware of that I discovered: you may not have 2 checkouts
of the same branch, something that is possible with what's currently
documented on the wiki. Since the only pain in the wiki workflow is
setting up a new branch (which I've scripted, attached) I've pretty much
given up on using worktrees.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)

Attachments:

newbranchtext/plain; charset=UTF-8; name=newbranch; x-mac-creator=0; x-mac-type=0Download