* Additional remote on a local clone. Where do the objects go?
@ 2010-09-01 7:12 Stephen Kelly
2010-09-01 10:32 ` Tay Ray Chuan
2010-09-01 10:34 ` Jakub Narebski
0 siblings, 2 replies; 6+ messages in thread
From: Stephen Kelly @ 2010-09-01 7:12 UTC (permalink / raw)
To: git
Hi,
I have done something like this :
git clone git://gitorious.org/qt/qt.git qtrepo
cd qtrepo
git checkout -b 4.7 origin/4.7
git checkout -b 4.6 origin/4.6
git clone qtrepo qt46
cd qt46 && git checkout -b 4.6 origin/4.6
cd ..
git clone qtrepo qt47
cd qt46 && git checkout -b 4.7 origin/4.7
cd ..
The aim is to have multiple local checkouts of different branches of Qt
while sharing the same object store. However, it is inconvenient to have to
pull in the qtrepo directory, then cd to the other two to get the changes.
It would be more convenient to be able to add the qt.git remote to the local
clones, pull from it, and have the pulled objects shared in the same object
store. Is that possible or is it what already happens? I will also want to
add additional remotes for pushing changes to from the local clones.
All the best,
Steve.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Additional remote on a local clone. Where do the objects go?
2010-09-01 7:12 Additional remote on a local clone. Where do the objects go? Stephen Kelly
@ 2010-09-01 10:32 ` Tay Ray Chuan
2010-09-01 11:51 ` Stephen Kelly
2010-09-01 10:34 ` Jakub Narebski
1 sibling, 1 reply; 6+ messages in thread
From: Tay Ray Chuan @ 2010-09-01 10:32 UTC (permalink / raw)
To: Stephen Kelly; +Cc: git
Hi,
On Wed, Sep 1, 2010 at 3:12 PM, Stephen Kelly <steveire@gmail.com> wrote:
> git clone git://gitorious.org/qt/qt.git qtrepo
> cd qtrepo
> git checkout -b 4.7 origin/4.7
> git checkout -b 4.6 origin/4.6
> git clone qtrepo qt46
> cd qt46 && git checkout -b 4.6 origin/4.6
> cd ..
> git clone qtrepo qt47
> cd qt46 && git checkout -b 4.7 origin/4.7
> cd ..
Two improvements: shared objects, and configuring git-pull:
git clone git://gitorious.org/qt/qt.git qtrepo
git init qt46
PARENT_GIT=$(pwd)/qtrepo/.git
cd qt46
# use of shared objects - tell git where to find the "missing" objects
cat $PARENT_GIT/objects > .git/objects/info/alternates
# setup of git pull
cat <<EOF >> .git/config
[remote "parent"]
url = $PARENT_GIT
[branch "master"]
remote = parent
merge = refs/remotes/origin/4.6
EOF
# done!
git pull
Repeat for 4.7.
If you want to go one step further and track these repos, you could
look at git-submodule or git-subtree.
--
Cheers,
Ray Chuan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Additional remote on a local clone. Where do the objects go?
2010-09-01 7:12 Additional remote on a local clone. Where do the objects go? Stephen Kelly
2010-09-01 10:32 ` Tay Ray Chuan
@ 2010-09-01 10:34 ` Jakub Narebski
1 sibling, 0 replies; 6+ messages in thread
From: Jakub Narebski @ 2010-09-01 10:34 UTC (permalink / raw)
To: Stephen Kelly; +Cc: git
Stephen Kelly <steveire@gmail.com> writes:
> The aim is to have multiple local checkouts of different branches of Qt
> while sharing the same object store. [...]
Why not use git-new-workdir shell script from contrib/worktree/ in
git sources[1]?
[1] http://repo.or.cz/w/git.git/blob_plain/HEAD:/contrib/workdir/git-new-workdir
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Additional remote on a local clone. Where do the objects go?
2010-09-01 10:32 ` Tay Ray Chuan
@ 2010-09-01 11:51 ` Stephen Kelly
2010-09-04 14:15 ` Tay Ray Chuan
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Kelly @ 2010-09-01 11:51 UTC (permalink / raw)
To: git
Tay Ray Chuan wrote:
> Hi,
>
> On Wed, Sep 1, 2010 at 3:12 PM, Stephen Kelly <steveire@gmail.com> wrote:
>> git clone git://gitorious.org/qt/qt.git qtrepo
>> cd qtrepo
>> git checkout -b 4.7 origin/4.7
>> git checkout -b 4.6 origin/4.6
>> git clone qtrepo qt46
>> cd qt46 && git checkout -b 4.6 origin/4.6
>> cd ..
>> git clone qtrepo qt47
>> cd qt46 && git checkout -b 4.7 origin/4.7
>> cd ..
>
> Two improvements: shared objects, and configuring git-pull:
I'm confused. I thought the local clone already used shared objects?
>
> git clone git://gitorious.org/qt/qt.git qtrepo
> git init qt46
> PARENT_GIT=$(pwd)/qtrepo/.git
> cd qt46
>
> # use of shared objects - tell git where to find the "missing" objects
> cat $PARENT_GIT/objects > .git/objects/info/alternates
>
> # setup of git pull
> cat <<EOF >> .git/config
> [remote "parent"]
> url = $PARENT_GIT
> [branch "master"]
> remote = parent
> merge = refs/remotes/origin/4.6
> EOF
So this will pull from the gitorious remote and store the objects in the
parent git from where they are shared with this local clone?
Which is the better solution between this and git-new-workdir given that
these are permanent branches, not temporary, and I'll want to push and pull
various clones and share the objects. It looks like the git-new-workdir
option creates symlinks, whereas the local clone creates hard links, and
this solution creates a redirect of sorts.
>
> # done!
> git pull
>
> Repeat for 4.7.
>
> If you want to go one step further and track these repos, you could
> look at git-submodule or git-subtree.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Additional remote on a local clone. Where do the objects go?
2010-09-01 11:51 ` Stephen Kelly
@ 2010-09-04 14:15 ` Tay Ray Chuan
2010-09-05 23:50 ` Stephen Kelly
0 siblings, 1 reply; 6+ messages in thread
From: Tay Ray Chuan @ 2010-09-04 14:15 UTC (permalink / raw)
To: Stephen Kelly; +Cc: Jakub Narebski, git
Hi,
(Please avoid dropping emails from the Cc list. Since you're using
gmail, you could use "Reply to all".)
On Wed, Sep 1, 2010 at 7:51 PM, Stephen Kelly <steveire@gmail.com> wrote:
> Tay Ray Chuan wrote:
>> Two improvements: shared objects, and configuring git-pull:
>
> I'm confused. I thought the local clone already used shared objects?
You'd have to use "-s/--shared" with git clone; I don't think it's
done by default.
(On hindsight, I should have used this instead of setting it up
manually by writing to .git/objects/info/alternates.)
> So this will pull from the gitorious remote and store the objects in the
> parent git from where they are shared with this local clone?
No, you'd have to first pull from gitorious in your parent directory,
before going into the local repo/branch (eg. qt46) and then pulling
again.
> Which is the better solution between this and git-new-workdir given that
> these are permanent branches, not temporary, and I'll want to push and pull
> various clones and share the objects. It looks like the git-new-workdir
> option creates symlinks, whereas the local clone creates hard links, and
> this solution creates a redirect of sorts.
I haven't used git-new-workdir comprehensively, so I'll avoid
commenting too much, but I'd like to know if you've looked at
branches? You can just switch between each and do your qt 4.6- and
4.7-specific work.
I say that, because what you're doing sounds like what a hg user would
do to emulate git branches.
--
Cheers,
Ray Chuan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Additional remote on a local clone. Where do the objects go?
2010-09-04 14:15 ` Tay Ray Chuan
@ 2010-09-05 23:50 ` Stephen Kelly
0 siblings, 0 replies; 6+ messages in thread
From: Stephen Kelly @ 2010-09-05 23:50 UTC (permalink / raw)
To: git
Tay Ray Chuan wrote:
> Hi,
>
> (Please avoid dropping emails from the Cc list. Since you're using
> gmail, you could use "Reply to all".)
Actually I'm posting using GMane through KNode. I'll keep you in the CC but
there's no need to CC me.
>
> On Wed, Sep 1, 2010 at 7:51 PM, Stephen Kelly <steveire@gmail.com> wrote:
>> Tay Ray Chuan wrote:
>>> Two improvements: shared objects, and configuring git-pull:
>>
>> I'm confused. I thought the local clone already used shared objects?
>
> You'd have to use "-s/--shared" with git clone; I don't think it's
> done by default.
Indeed, --local is default, which sets up hard links, so they are shared in
that sense. So it looks like the suggestion is I should remove the --local
clones and start again with --shared so that the objects directory is
symlinked? Is that better than hard links?
>
> (On hindsight, I should have used this instead of setting it up
> manually by writing to .git/objects/info/alternates.)
>
>> So this will pull from the gitorious remote and store the objects in the
>> parent git from where they are shared with this local clone?
>
> No, you'd have to first pull from gitorious in your parent directory,
> before going into the local repo/branch (eg. qt46) and then pulling
> again.
Right. That's what I do currently, but it's not optimally convenient. I'd
like to just go to the qt46 clone, set it up with the correct remote url and
pull there, with the result being that the objects I pull are still shared
across all the local clones.
>
>> Which is the better solution between this and git-new-workdir given that
>> these are permanent branches, not temporary, and I'll want to push and
>> pull various clones and share the objects. It looks like the
>> git-new-workdir option creates symlinks, whereas the local clone creates
>> hard links, and this solution creates a redirect of sorts.
>
> I haven't used git-new-workdir comprehensively, so I'll avoid
> commenting too much, but I'd like to know if you've looked at
> branches? You can just switch between each and do your qt 4.6- and
> 4.7-specific work.
Switching between branches costs time and I often need to work with more
than one at a time, and I need separate build directories for them, so I'm
trying to get these 'permanent checked-out branch directories' set up
conveniently.
>
> I say that, because what you're doing sounds like what a hg user would
> do to emulate git branches.
>
I only used hg for the first time on Friday to clone a repo. Not sure what
the workflow with that SCM is.
Thanks for the pointers,
Steve.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-05 23:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-01 7:12 Additional remote on a local clone. Where do the objects go? Stephen Kelly
2010-09-01 10:32 ` Tay Ray Chuan
2010-09-01 11:51 ` Stephen Kelly
2010-09-04 14:15 ` Tay Ray Chuan
2010-09-05 23:50 ` Stephen Kelly
2010-09-01 10:34 ` Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).