git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git cloning paths
@ 2012-07-12 22:17 Douglas Garstang
  2012-07-13  8:07 ` Jeff King
  2012-07-25 15:22 ` Caleb Marchent
  0 siblings, 2 replies; 3+ messages in thread
From: Douglas Garstang @ 2012-07-12 22:17 UTC (permalink / raw)
  To: git

All,

I'm a relative newcomer to git and I've just inherited a setup where
all of the company's code is in a single git repository. Within this
repository are multiple projects. It seems that git doesn't natively
allow cloning/checking out of individual paths within the repo (ie
projects), which would seem to make integrating git with a continuous
build system rather difficult. That is, the build system has to clone
the entire repo, and therefore a change to any project will result in
the entire contents of the repo being built.

Correct....?

Doug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: git cloning paths
  2012-07-12 22:17 git cloning paths Douglas Garstang
@ 2012-07-13  8:07 ` Jeff King
  2012-07-25 15:22 ` Caleb Marchent
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff King @ 2012-07-13  8:07 UTC (permalink / raw)
  To: Douglas Garstang; +Cc: git

On Thu, Jul 12, 2012 at 03:17:09PM -0700, Douglas Garstang wrote:

> I'm a relative newcomer to git and I've just inherited a setup where
> all of the company's code is in a single git repository. Within this
> repository are multiple projects. It seems that git doesn't natively
> allow cloning/checking out of individual paths within the repo (ie
> projects), which would seem to make integrating git with a continuous
> build system rather difficult. That is, the build system has to clone
> the entire repo, and therefore a change to any project will result in
> the entire contents of the repo being built.
> 
> Correct....?

Yes. The feature you are looking for is either "sparse checkout" (only
check out a subset of the files in the repository databse to the working
tree) or "sparse clone" (only copy a subset of the files into the local
repository database during clone). Git v1.7.0 and later has sparse
checkout (see the "sparse checkout" section in "git help read-tree").
There is no implementation for sparse clone (and not likely to be one
any time soon, as it introduces a lot of complexity into the object
negotiation phase).

The usual advice is that you should break up your big repository into
logical projects. You can do so with git-filter-branch, but beware that
this involves rewriting history, which means a flag day for everybody
switching to the new history (or dealing with migrating commits from the
old history to the new history via rebase).

Finally, if you have a build system which is cloning repeatedly, you may
want to keep a repository on the build server all the time and just
fetch the updates into it. This is much more efficient even if you do
end up paring down your repository.

-Peff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: git cloning paths
  2012-07-12 22:17 git cloning paths Douglas Garstang
  2012-07-13  8:07 ` Jeff King
@ 2012-07-25 15:22 ` Caleb Marchent
  1 sibling, 0 replies; 3+ messages in thread
From: Caleb Marchent @ 2012-07-25 15:22 UTC (permalink / raw)
  To: Douglas Garstang, git@vger.kernel.org

Hi Doug,

The method I have been using to achieve this is to create a wrapper script that does the following:

git clone -n                                   # clone, but don't checkout
cd <repo name>                        
git config core.sparseCheckout true    # configure sparse-checkout on
# echo the list of bits you want into .git/info/sparse-checkout
git checkout

Do watch out though, the interpretation of the sparse-checkout file has changed since git 1.7, I would suggest you use the latest git and record the git version as a comment in top of the sparse checkout file, in case it changes again. 

I hope this helps,

Caleb

-----Original Message-----
From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On Behalf Of Douglas Garstang
Sent: 12 July 2012 23:17
To: git@vger.kernel.org
Subject: git cloning paths

All,

I'm a relative newcomer to git and I've just inherited a setup where all of the company's code is in a single git repository. Within this repository are multiple projects. It seems that git doesn't natively allow cloning/checking out of individual paths within the repo (ie projects), which would seem to make integrating git with a continuous build system rather difficult. That is, the build system has to clone the entire repo, and therefore a change to any project will result in the entire contents of the repo being built.

Correct....?

Doug.
--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-25 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12 22:17 git cloning paths Douglas Garstang
2012-07-13  8:07 ` Jeff King
2012-07-25 15:22 ` Caleb Marchent

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).