Git repository

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Git repository

Post by cha0s »

Hello everyone!

Me and dkl have been working sorta behind the scenes to get the source repository converted to git from SVN. He has really done a lot of the work so everyone give him a hand, please!

Anyways, today was the day when I put the repository up on sourceforge.net! You can see it here"

http://fbc.git.sourceforge.net/git/gitw ... ;a=summary

Also, you can find the details on viewing the repository at https://sourceforge.net/scm/?type=git&group_id=122342

Well guys, I just wanted to let you know this was happening, and would love your comments, and especially any bug eports, as chances are I screwed something up in the process!

Thanks guys.
Sisophon2001
Posts: 1706
Joined: May 27, 2005 6:34
Location: Cambodia, Thailand, Lao, Ireland etc.
Contact:

Post by Sisophon2001 »

I have not used git before. What is the minimum I need to know to download (update) my local repository? From reading the git --help this is what i tried.

~/gitfbc $ git --git-dir=git://fbc.git.sourceforge.net/gitroot/fbc/fbc fetch

fatal: Not a git repository: 'git://fbc.git.sourceforge.net/gitroot/fbc/fbc'

Garvan

PS. Nice to see you back.
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

Hey Garvan,

Instead of 'checkout', as we did for SVN, we use the term 'clone' for git. The command to clone the repository is like this:
bash wrote:$ git clone git://fbc.git.sourceforge.net/gitroot/fbc/fbc
Initialized empty Git repository in /wherever/you/are/fbc/.git/
remote: Counting objects: 69804, done.
remote: Compressing objects: 100% (15749/15749), done.
remote: Total 69804 (delta 49631), reused 69804 (delta 49631)
Receiving objects: 100% (69804/69804), 18.45 MiB | 2.23 MiB/s, done.
Resolving deltas: 100% (49631/49631), done.
The equivalent to 'svn update' will be:
bash wrote:$ git pull
Already up-to-date.
Unfortunately, I don't believe there is a way for us to only download the 'FreeBASIC' sub-directory from the repository, in SVN terms this means that you can only pull /trunk, not /trunk/FreeBASIC. We'd like to remove web from the repository, but we haven't decided how best to do that yet.

So at this point, most of the juicy files will be in ./fbc/FreeBASIC

Let me know if you have any further questions.
Sisophon2001 wrote:PS. Nice to see you back.
Thanks!
SARG
Posts: 1764
Joined: May 27, 2005 7:15
Location: FRANCE

Post by SARG »

@Cha0s
So far I don't really manage versions/mods of codes. So the use of a tool like Git would be a avantage when doing several modifications in same time. But for a personnal use (locally on a PC), is it easy to implement ?

Perhaps are there other tools more adapted ?

Thanks in advance.
SARG.
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

SARG wrote:But for a personnal use (locally on a PC), is it easy to implement ?
Well, if you aren't interested in making modifications, the two commands I posted, 'clone' and 'pull' will be all you need. =)
SARG
Posts: 1764
Joined: May 27, 2005 7:15
Location: FRANCE

Post by SARG »

Sorry not to be clear, it was more a question 'beside'. :-)
I'm talking about a tool to manage my own programs.
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

Ah yes, extremely easy!
$ mkdir my-project
$ cd my-project/
$ echo 'print "Hello, world!"' > main.bas
$ git init
empty Git repository in my-project/.git/
$ git add .
$ git commit -m 'Initial commit'
[master (root-commit) 02fbd58] Initial commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 main.bas
Now it exists. Make a change:
$ echo -e 'sleep' >> main.bas
$ cat main.bas
print "Hello, world!"
sleep
$ git commit -am "Wait before closing."
[master 23c2be2] Wait before closing.
1 files changed, 1 insertions(+), 0 deletions(-)
Let's review what we've done:
$ git log --pretty=oneline -u
Wait before closing.
--git a/main.bas b/main.bas
4351743..4c59365 100644
a/main.bas
b/main.bas
-1 +1,2 @@
print "Hello, world!"
+sleep
Initial commit
--git a/main.bas b/main.bas
file mode 100644
0000000..4351743
/dev/null
b/main.bas
-0,0 +1 @@
+print "Hello, world!"
$
Aave
Posts: 128
Joined: Jun 13, 2008 19:55
Location: Helsinki, Finland

Post by Aave »

This is excellent! Git is my weapon-of-choice when it comes to version control.

However, sf.net's Git hosting is not so good (comparing it to github and gitorious, sf.net has ugly web interface and none of the additional work-flows (fork - then make a pull request) and social aspects that the others have. I also find it a bit slower to respond. Then again I guess sf.net makes sense since the other parts of the project are hosted there.

As for the web site, sf.net supports multiple git repositories, so just separate the web site into another repo.

I also give a note that technically git clone is not equivalent to svn checkout trunk, because the clone will also pull every branch, every tag and the whole commit history. You should not be afraid of that though, branches and tags are extremely lightweight in git - they are merely pointers to a commit pool, so you won't e.g. get 100+ directories as you would with svn if you would checkout every tag and branch.

Speaking of which, I only see the master branch in the git repo, where are all the tags and branches?
Dr_D
Posts: 2451
Joined: May 27, 2005 4:59
Contact:

Post by Dr_D »

I'm just curious as to what benefits are gained from switching to GIT. Keep in mind that I've never had any issues with SVN. I've never contributed to a project nearly the size of FreeBASIC either though, so I really have no idea what the issues are/were.. or maybe I just learned to ignore the bugs. :p
Oz
Posts: 586
Joined: Jul 02, 2005 14:21
Location: Waterloo, Ontario, Canada
Contact:

Post by Oz »

Just to toss in my two cents, I have to use git at work all the time, and here are the pros and cons:

pros:
* easy to manage multiple parties pushing modifications (using stash and merge)
* i find that it's a little faster than cvs and svn, but I don't know if that's across all systems
* it's fairly straight forward
* once you clone a repo, you don't have to specify the git address for every pull or push
* git feels more secure than svn or cvs
* a clone means you have your own copy of the repo, that can act just like a separate git server, which means it's easier to branch and merge!

cons:
* well, as much as it may be straight forward, if you accidently do something weird in your local copy of the repo, you may find that you'll have to grab a new clone - git has really bad recovery support for things like this. this can be caused by any number of things, most of which I had done within the first month of using git.
* I haven't found a good win32 front-end to it - but the command line is fairly straight forward

As far as what advantages we, as the fb community, will see: not a whole lot, from a user perspective, but in the cases of developers, it'll be easier to push and pull code without losing changes if someone pushed code while you were about to (meaning there would be a conflict, since you'd be uploading older code).

That's my rundown, anyway.
-Oz
Aave
Posts: 128
Joined: Jun 13, 2008 19:55
Location: Helsinki, Finland

Post by Aave »

Dr_D wrote:I'm just curious as to what benefits are gained from switching to GIT. Keep in mind that I've never had any issues with SVN. I've never contributed to a project nearly the size of FreeBASIC either though, so I really have no idea what the issues are/were.. or maybe I just learned to ignore the bugs. :p
As Oz said, a user simply compiling and not developing is not going to see much benefits, perhaps even on the contrary: although I find git's command line output far superioir to svn's when downloading stuff, git clone contains more megabytes than an svn checkout (then again git supports shallow clones where you only take n-steps of history instead of the whole repo).

Oz mentioned speed and I'd like to elaborate on that as it is one of the most annoying things about svn. Git is blazingly fast doing things, it is probably the fastest version control system, but in every day use it doesn't really matter if a commit takes 6ms or 160ms (comparing to other distributed systems). However, with svn and other non-distributed VC-systems, there is the network latency that creates long waits. After you have gotten used to git's instant commands, waiting for e.g. svn's log for even two seconds feels like a very long time and that's not counting the times when the server is slow to respond, potentially taking ages to complete (or even fail) the command.

Also, since all commands except for git push work on the local repository copy, you can do development offline - e.g. go to an airplane and commit, branch and merge stuff like crazy and once you touch down, then share your stuff by updating the server copy. I was working in a company last year that uses svn and there were a couple of times when the svn server connections broke and at those times the development almost halts or at least slows down significantly.
VonGodric
Posts: 997
Joined: May 27, 2005 9:06
Location: London
Contact:

Post by VonGodric »

major downside in my opinion is that if you don't do git push (and its easy to forget -after all you do commit changes to local repo) and something happens to your hdd/computer -your work is lost. While with svn every commit goes to central server. Of course if something happens to the server your code might be lost as well, but that's less likely.
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Post by dkl »

Yesterday I uploaded a new better git translation of our svn repo, the commit hashes have changed, so please re-clone if you cloned it already. Sorry for the trouble!
TeeEmCee
Posts: 375
Joined: Jul 22, 2006 0:54
Location: Auckland

Post by TeeEmCee »

Wonderful! I did this myself last year, but never uploaded it because git-svn refused to recognise certain branches as branches and was instead trying to duplicate the history for each of them, so I skipped them. I'm not sure how you dealt with this (is this why most of the branches have been translated into tags?), but I'm glad that someone other than me has sorted this out, and that I'm not the only one around here who thinks^Wknows git is superior :)
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Post by dkl »

Oh, we noticed the same problems with git-svn, it's just that it wasn't designed to be a one-time converter, and so it doesn't handle non-standard svn repos as nicely as one would hope when moving to git for good. Now the current repo was made with svn2git (from KDE, also known as svn-all-fast-export), which is a somewhat nicer experience for this purpose. The translation script for fbc's svn repo is on Sourceforge too: fbcsvn2git

Most branches are still branches, except for the C emitter and PrintUsing branches, those are long merged in and there's no point in keeping them as git branches. The others are all tags, many since the CVS days already, the pre 0.18 ones I think.
Post Reply