3

Is it possible to clone only a single git branch in hudson ? Hudson version 2.2.0 with git plugin version 2.2.0 clones the entire specified project, thus occupying lot of space (which is expected to grow forever)

Thanks in advance.

crankparty
  • 1,170
  • 3
  • 16
  • 26

4 Answers4

4

Configuring refspec in the hudson-git plugin to the following value seems to be working:

+refs/heads/master:refs/remotes/origin/master
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
crankparty
  • 1,170
  • 3
  • 16
  • 26
2

Not directly, but if you can adapt the Hudson Git Plugin itself, you could clone only a branch with the right git command:
See "How to clone a single branch in git?"

This is possible since git1.7.10:

git clone <url> --branch <branch> --single-branch <folder>

Note that the git plugin 2.0 will allow to specify the right branch to clone:

git 2.0

Community
  • 1
  • 1
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
0

You are confusing clone with checkout. Clone clones a repository, and that's how git works, checkout wil switch you to a given branch. Git is distributed thus, whole repository is copied with clone to your local machine. So you can access any branch, commit, tag, ever pushed.

damiankolasa
  • 1,498
  • 9
  • 8
  • Agreed that clone is different from checkout . But still , i meant to ask if we can do 'git archive' or someother git trick to reduce space consumption – crankparty Dec 07 '12 at 11:26
0

A git "branch" is just a 40-byte bookmark pointing to a position in the project history -- unless your branches are massively divergent, you aren't really saving much space, as you'll be downloading the full history anyway.

If space saving is the goal, perhaps use the "shallow clone" option? That'll only download one layer of history, rather than all of it.

Shish
  • 2,546
  • 17
  • 16