Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does 'svn ignore' not ignore?

Tags:

ignore

svn

I'm trying to add a Linux kernel to an 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 directory?

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
like image 453
Mingus Avatar asked Sep 21 '09 01:09

Mingus


People also ask

What does svn ignore do?

The svn:ignore property is a good way to tell Subversion to ignore files that are likely to be present in every user's working copy of that directory, such as compiler output or—to use an example more appropriate to this book—the HTML, PDF, or PostScript files generated as the result of a conversion of some source ...

How do I ignore bin and obj folder in svn?

The text box “Global ignore pattern” defines what patterns you want to exclude; in my case I wanted to remove bin and obj folders, and ReSharper related files, which typically contain _ReSharper, so I added bin obj _ReSharper to the list of patterns. Et voila!


3 Answers

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.

like image 132
Greg Hewgill Avatar answered Nov 09 '22 07:11

Greg Hewgill


The first svn propset sets the svn:ignore property on the parent directory of a.

The second svn propset does nothing, because a is not under SVN management yet.

like image 45
phsiao Avatar answered Nov 09 '22 08:11

phsiao


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 file ~/.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
like image 5
Peter Parker Avatar answered Nov 09 '22 08:11

Peter Parker