tags:

views:

698

answers:

3

I'm trying to add a linux kernel to a svn tree, which has a .git subdirectory - which I don't want to add. Can anyone explain this behaviour - why does it NOT ignore the .git direcotry ?

test2$ mkdir -p a/.git/blah
test2$ ls
a
test2$ svn propset svn:ignore .git .
property 'svn:ignore' set on '.'
test2$ svn propset -R svn:ignore .git .
property 'svn:ignore' set (recursively) on '.'
test2$ svn add a
A         a
A         a/.git
A         a/.git/blah

Thanks

+6  A: 

The first svn ps sets the ignore on the parent directory of a.

The second svn ps does nothing, because 'a' is not under svn management yet.

phsiao
+5  A: 

The svn:ignore property on a directory lists the names in the current directory that will be ignored. You have set the svn:ignore property on your current directory to .git, but that does not apply to the subdirectory a. What you can do is first add a non-recursively:

svn add -N a
svn ci -m "add a directory"

Then set the svn:ignore property:

svn propset svn:ignore .git a

and then add your tree:

svn add a

This should ignore the a/.git directory.

Greg Hewgill
+1  A: 

the svn:ignore property is for ignoring files in already added directories.

For avoiding the import of files(or directories), you should use the global-ignores-feature, which is configurable in ~/.svn/config(UNIX) or %APPDATA%\subversion\config (windows) in the [miscellany] section.

Activate it by removing the # in front of the line:

global-ignores = .git
Peter Parker
The problem with global-ignores is that the next guy to use the repo is *not* going to ignore the stuff you want to avoid seeing in the repo.
Coderer
for this you can use a pre commit hook with a forced global ignore file
Peter Parker