r/programming • • Nov 16 '13

What does SVN do better than git?

http://programmers.stackexchange.com/questions/111633/what-does-svn-do-better-than-git
599 Upvotes

494 comments sorted by

View all comments

90

u/dcxi Nov 16 '13

Being able to clone subtrees is quite handy. I often miss it when using git/hg.

38

u/magocto Nov 16 '13

I also miss this. Nothing is worse than having to clone the whole repo to change a line of text in a 2 gig legacy project.

14

u/cridenour Nov 16 '13

If it happens to be on github, you can do it all in the browser now. Though the fork would take a while.

4

u/dcxi Nov 16 '13

It's also handy for distribution sometimes.

Let's say I want to port the games from 100 basic computer games to C. Of course, being the most popular game, one user only wants Super Star Trek. With git/hg it's either all or nothing, or create 100 repos (ha), one for each game.

39

u/xiongchiamiov Nov 16 '13

What's wrong with 100 repos for 100 different projects?

6

u/notcanadian_really Nov 16 '13

As somebody who manages repos at his company, constantly cloning repos is pretty huge time suck.

17

u/VortexCortex Nov 16 '13 edited Nov 16 '13

That's why I have one or a few Git repos, and branches for for the different sub projects. These sub project branches can merge with a "stable" branch for the entire set easily. I also have a meta "release" repo that has submodules of all the other projects in a family so those 100 projects would be broken down into 5-10 repos, and the entire 100 super project repo that tracks "relesable" versions clones from them and is updated via single "git pull && git submodule update".

This means once I've added submodules to the meta repo, anyone can clone the meta repo and checkout all the submodules too, or selectively checkout / update the submodules. I can clone 100 repos in one line, or just the specific "sub-tree" I need to update. Now what?

Branches > submodules > clones.

→ More replies (1)

5

u/s73v3r Nov 16 '13

It is, but it's far better than having a bunch of noise from unrelated projects in the log and constantly having to merge.

→ More replies (1)
→ More replies (1)

1

u/benrules2 Nov 16 '13

Can't you just do this by running git checkout path/to/file ?

→ More replies (3)
→ More replies (4)

10

u/tikhonjelvis Nov 16 '13

One of the comments in the linked question suggests that git subtree has been part of git since 1.8.0.

I didn't know about it either, but it looks neat.

20

u/Plorkyeran Nov 16 '13

git subtree doesn't really solve the problem that cloning a subtree in SVN does, since you need a clone of the full original repo to create the subrepo.

11

u/holgerschurig Nov 16 '13

At least GIT has since ages the "--depth" option for git clone:

   --depth <depth>
       Create a shallow clone with a history truncated to the specified number of revisions. A shallow
       repository has a number of limitations (you cannot clone or fetch from it, nor push from nor
       into it), but is adequate if you are only interested in the recent history of a large project
       with a long history, and would want to send in fixes as patches.

7

u/ruinercollector Nov 16 '13

Only really good for read access.

5

u/ethraax Nov 16 '13

Not necessarily. Can't you make a shallow clone, make your changes, make a commit, and then email that commit as a patch to the project maintainer?

16

u/ruinercollector Nov 16 '13

Yes. Yes, you can do that.

But seriously.

12

u/mojomonkeyfish Nov 17 '13

This is the "answer". This is what separates Git from Mercurial or SVN. It's what I call the "open source lizard brain". It's a mentality that many species of early open source projects (linux being the shining example) still operate on. It's a kind of hostile expertise. If you complain that you can't turn the software left, you'll get this "God, you just have to twist these two valves, let the steam pressure build up, open the release valve and then turn the crank 2 or three turns. Then, it's so trivial to just unlock the main steering assembly and radio the appropriate commands to the wheelman. It's not like you can't turn left, this is the most versatile and powerful vehicles on the planet."

Mind you, this attitude has seen a significant decline over the last decade. Open source projects have moved to actually become accessible, rather than just some mad-tailor's bespoke suit that you're free to wear.

When researching, setting up, and using Git, I was like "God, this feels like 1998." "Oh, hey, what do you know, this is Linus' brainchild." God bless the man.

→ More replies (5)

2

u/ethraax Nov 16 '13

It depends on the project. For some projects, posting patches on mailing lists is the preferred way to contribute. I'm pretty certain this is true of the Linux kernel, which was one of the primary projects that Git was designed to handle, so it makes sense that it works well there.

13

u/TomRK1089 Nov 16 '13

That's so close to 'read access' as to make no practical difference, in my opinion.

2

u/ethraax Nov 16 '13

That's fine, and I agree that it would be cool to be able to push from a shallow clone to a full copy, but it's worth noting that some projects prefer patches to be send via email. Or maybe posted to a forum or to an issue tracker. Pretty much the only trouble is when you try pushing directly to a remote repo, which guests are generally not allowed to do.

→ More replies (4)
→ More replies (5)

3

u/kerbuffel Nov 16 '13

What is the technical reason that dcvses don't allow subtree checkouts?

10

u/yur_mom Nov 16 '13

They require the whole repo filesystem to properly track changes. The fact that svn allows this actually causes some merge nightmares later down the road since it is only really tracking changes to single files. It is still a huge advantage as long as you know the limitations caused by this with moving files.

2

u/jlt6666 Nov 17 '13

I though SVN had recently addressed some of these issues at least in regards to treating moves in a way that maintains history. (or possibly that they were going to work on patching some of the gaps that git fills) I guess I'd have to look.

4

u/yur_mom Nov 17 '13

They said they were planning to fix, but still have not fixed this bug since 2002 http://subversion.tigris.org/issues/show_bug.cgi?id=898

→ More replies (1)

2

u/weedtese Nov 16 '13

google's repo tool + multiple git repositories

→ More replies (1)