project-navigation
Personal tools

Author Topic: How do I download just the newest branch and NOT the whole repository in git?  (Read 6959 times)

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
Hi I am a novice hobby compiler or this program/game and some others on the net and am trying to get the latest git source to compile but am having trouble working out how to download just the 2.4dev branch and NOT the whole repository through tortisegit or gitbash (preferably tortisegit or something simular).  Your latest guide on downloading mensions to download tortisegit for the windows platform but the compile instructions are only for gitbash or simular commandline git program?  I can download the entire thing through either but I would very much prefer to just download the latest build (git master branch ? ) and NOT the whole repository.  Also I used to use make ufo ai tool to auto download and compile for me but now that svn is no longer valid is there a way to modify it to use git instead so I can continue to do it the same convenient method with the latest git code?  Hopefully there is or you are planning on releasing a newer version with git source support :)  If not I will have to learn to use cg or equilipse :( and do maps and language separatly.  I personally have only really used visual studio professional 2008 so am inexperienced in other compilers.  Thank you in advance for any help or tips :)

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
I think u can't. The only one way is on the wiki http://ufoai.ninex.info/wiki/index.php/Download

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Well the wiki had at some point the following instructions:

git init ufoai
cd ufoai
git remote add -t master origin git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai
git fetch
git checkout -t origin/master

That should download the master branch only, but they were taken down for a reason I presume? Maybe it won't work anymore?
If you are only interested in the latest code you could make a shallow clone of the repo and skip downloading all the project's history or if you are daring you could also try a shallow fetch

Only add the option:  --depth 1  to the git clone command (or git fetch if you are trying the shallow fetch with the instructions above)
that should download only the latest state and skip the history

How to do it with tortoisegit? I don't know

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
thanks trying that now but as soon as I type in the git remote option it seems to start up wants to download nearly 1/4 million objects before I even get to type in the fetch command and becuase it's downloading to a temp package via bash instead of direct copy while in transfer I can't see what it's downloading either.  but becuase when I did it with tortise svn and git bash before it said the same amount of objects I am fairly sure it didn't work and is still downloading the entire repository tree dispite the add -t master orginal command line switches to the remote command.  Maybe the source for just the master is alot bigger then I thought.  I remember downloading for the 1st time the 2.4dev branch only on svn not long back and didn't take all that much download and time but maybe I am miss remembering?  How many objects and total size is the 2.4dev branch (now master in git?) anyway? thanks again for your help so far :)

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
thanks trying that now but as soon as I type in the git remote option it seems to start up wants to download nearly 1/4 million objects before I even get to type in the fetch command
That's odd it works for me here. Did you copy paste ALL the commands to git bash? If so it will execute them all one after the other, including the fetch command
Quote
but becuase when I did it with tortise svn and git bash before it said the same amount of objects I am fairly sure it didn't work and is still downloading the entire repository tree dispite the add -t master orginal command line switches to the remote command.  Maybe the source for just the master is alot bigger then I thought.  I remember downloading for the 1st time the 2.4dev branch only on svn not long back and didn't take all that much download and time but maybe I am miss remembering?  How many objects and total size is the 2.4dev branch (now master in git?) anyway? thanks again for your help so far :)
Without the --depth 1 option it will try to download all the history of the master branch, since all other branches were, well, branched from master and some were merged back to it, the history of the master branch is pretty much the history of the whole repo (git imported all the svn history from rev 1)

I tryied it with
git init ufoai
cd ufoai
git remote add -t master origin git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai
git fetch --depth 1
git checkout -t origin/master

only 9600~ objects (590~ Mb) to download

I suggest you try again typing one command at a time, if you are already doing that you could try to abort the download [Ctrl-C] and then start it again with the above fetch command.

If that still doesn't work

git clone --depth 1 git://ufoai.git.sourceforge.net/gitroot/ufoai/ufoai

will download around 32000~ objects
« Last Edit: September 09, 2010, 03:04:14 am by DarkRain »

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
thanks! that last one only started downloading after I typed in the fetch command this time and with --depth 1 it just downloads the amount that you said so looks like it worked.  Downloading it now and once it's done I will try and learn/setup/install cg or equilpse and see if it builds correctly.  Will let you know what happens :) I must say though this git is ALMOST more work then svn for ppl like me :( oh well hopefully it helps the developers do things easier that's the main thing :)

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
sorry ment to type ALOT not ALMOST lol always do that thing one word and type another hehe

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Well, no expert in GIT here but when the UFO:AI switched from SVN I spent almost one week using my free time to read about GIT before getting the courage (and chance) to switch, so I learned one or two things

Anyways, you are absolutely right here:
hopefully it helps the developers do things easier that's the main thing :)

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
Update:  downloaded source code and built with cg with 0 errors and 53 warning messages.  Now attempting to build maps.  Also does anyone know how to set cg so that it compiles the bin in a certain directory or configure the source so that the compiler compiles it in a certain place?  Because as it is it compiles a copy of the binary in the same directory as the source download which is rather messy and pretty much impossible to separate after it has been built.  Will let you know how the map compiling goes and how the binary turns out.  Thanks again for all the help so far

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
update 2: well I downloaded and built the base game fine but when I use python to do the maps it says line corruption or something y/n I type y then it just says version mismatch on all the files?  Any idea what I did wrong there?  Plus I noticed that when I have built from svn in the past it says down the bottom of main menu in game what svn build no. it is and my git compile doesn't have a build no. is that normal?  Can't really test my build till I get next problem sorted the maps but at least I got just the latest version of the base game compiled via git so far thanks to all your help :) any ideas on the map/python issue?

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: How do I download just the newest branch and NOT the whole repository in git?
« Reply #10 on: September 09, 2010, 09:48:43 am »
update 2: well I downloaded and built the base game fine but when I use python to do the maps it says line corruption or something y/n I type y then it just says version mismatch on all the files?  Any idea what I did wrong there?

The map-get.py is not currently working, but will hopefully get fixed soon.

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
Re: How do I download just the newest branch and NOT the whole repository in git?
« Reply #11 on: September 09, 2010, 10:52:56 am »
TY h-hour will there be some sort of news post on mainpage or forum post?  Or just keep checking to see?

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
Re: How do I download just the newest branch and NOT the whole repository in git?
« Reply #12 on: September 09, 2010, 10:54:45 am »
and thanks heaps dark rain and bayo for all your assistance looks like I got it as far as I can for the moment until the fix maps.  Couldn't have done it without all the assistance especially from dark rain :)

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: How do I download just the newest branch and NOT the whole repository in git?
« Reply #13 on: September 09, 2010, 11:58:57 am »
TY h-hour will there be some sort of news post on mainpage or forum post?  Or just keep checking to see?

I'll try to remember to make a post about it when it's working, but keep checking in case I forget. ;)

Offline Whitecrow

  • Rookie
  • ***
  • Posts: 12
    • View Profile
Re: How do I download just the newest branch and NOT the whole repository in git?
« Reply #14 on: September 09, 2010, 01:36:35 pm »
k thanks will do