project-navigation
Personal tools

Author Topic: Git Bundle  (Read 7321 times)

Offline yobbo

  • Cannon Fodder
  • **
  • Posts: 6
    • View Profile
Git Bundle
« on: June 18, 2013, 11:43:42 am »
Would it be possible to provide a git bundle for those who want to clone the git repository?

It is a very large download, and it seems that git cannot resume if it fails. After four hours and 1.4GB of data, my internet connection gave in, and there was no way to resume. If there were a git bundle to some recent point (say the 2.4 version), then that could be downloaded via normal means (such as http download or torrent), and used to clone the repository, then one could update it from there.

EDIT: Bundle added, thanks H-Hour :)

simple instructions for using it are: (replace '../ufoai-master-01d1bbf-2013-06-17.bundle' with wherever the bundle is and whatever it's called, i ran this from where the bundle was):

Code: [Select]
git init ufoai
cd ufoai
git pull ../ufoai-master-01d1bbf-2013-06-17.bundle master
git remote add origin git://git.code.sf.net/p/ufoai/code --track master
git pull

This will track the master branch. After that you can update whenever you like with

Code: [Select]
git pull
« Last Edit: June 20, 2013, 03:21:38 pm by yobbo »

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: Git Bundle
« Reply #1 on: June 18, 2013, 03:16:39 pm »
I'm only a basic user of git, so to be certain, do you mean running:

Code: [Select]
git bundle create repo.bundle --all
Then creating a torrent with that file and sharing it?

Offline yobbo

  • Cannon Fodder
  • **
  • Posts: 6
    • View Profile
Re: Git Bundle
« Reply #2 on: June 19, 2013, 07:27:28 am »
Hi, thanks for your quick reply :).

Yes that is the idea, but I think bundling only the master branch is easiest. Probably most of the data is in there, and that way it could be used for those who just want the master branch, as well as those who want to clone the whole repo.

I've never used git bundles before either, so I did some research (and some testing on one of my other repos), and came up with the following process.



TO CREATE A BUNDLE

As long as it contains most of the data, that's good enough, so it can probably just be of the master branch:

Code: [Select]
git bundle create ufoai.bundle master
This will create a bundle containing all the commits in the master branch. It can be updated if a lot of data gets added, but as long as it has the bulk of the repo that's probably fine.



TO USE THE BUNDLE TO CLONE THE GIT REPO (summary at the bottom)

Assuming you have the ufoai.bundle file in your current directory:

Code: [Select]
git init ufoai
cd ufoai
git pull ../ufoai.bundle master

This will pull all the commits up until whenever the bundle was created, and put them in the 'master' branch of the new repo.

Now we want to link to the actual repo, and bring our copy up-to-date with it.

If all we want is the master branch, we can do

Code: [Select]
git remote add origin git://git.code.sf.net/p/ufoai/code --track master
git pull

but if we want to be able to track all the branches, it's better to do

Code: [Select]
git remote add origin git://git.code.sf.net/p/ufoai/code
git fetch
git merge origin/master

and then to set the default upstream for pulling and pushing.

Code: [Select]
git branch --set-upstream-to origin/master


At this point you can see all the remote branches with

Code: [Select]
git branch -r
unless you used '--track master', in which case you have to manually add any branches you want to see with

Code: [Select]
git remote set-branches --add origin <branchname(s)>
git fetch

now assuming 'git branch -r' shows everything you want, and has exactly one branch with the name you want to work on, you can switch to and track any of the existing remote branches with 'git checkout'. For example

Code: [Select]
git checkout renderer_work
would be shorthand for 'git checkout -b renderer_work --track origin/renderer_work'



SO TO SUMMARIZE:


OPTION A: MASTER ONLY

Code: [Select]
git init ufoai
cd ufoai
git pull ../ufoai.bundle master
git remote add origin git://git.code.sf.net/p/ufoai/code --track master
git pull

-> should be up-to-date and tracking master, patch away


OPTION B: WHOLE REPO

Code: [Select]
git init ufoai
cd ufoai
git pull ../ufoai.bundle master
git remote add origin git://git.code.sf.net/p/ufoai/code
git fetch
git merge origin/master
git branch --set-upstream-to origin/master

-> up-to-date, tracking master, and can check out and work on other branches.



For reference, another project which uses a git bundle for their data is FlightGear: http://wiki.flightgear.org/Git
« Last Edit: June 20, 2013, 03:29:53 pm by yobbo »

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: Git Bundle
« Reply #3 on: June 20, 2013, 02:41:24 pm »
Ok, I've created the bundle and I'm seeding the torrent now. You can download the torrent from our download page (look under Development).

This is a bundle of just the master branch up to the latest commits yesterday when I made it. It's 2.87gb. It'd be great if others who torrent and have an unlimited data connection could also seed this.