Browse Source

add Git, Mercurial and Bazaar files/dirs to defaultexcludes. Submitted by Ville Skyttä. PR 49624

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@982469 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
43de42a38f
4 changed files with 84 additions and 1 deletions
  1. +4
    -0
      WHATSNEW
  2. +18
    -1
      docs/manual/dirtasks.html
  3. +20
    -0
      src/main/org/apache/tools/ant/DirectoryScanner.java
  4. +42
    -0
      src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java

+ 4
- 0
WHATSNEW View File

@@ -42,6 +42,10 @@ Changes that could break older environments:
of Ant 1.8.1.
Bugzilla Report 49373.

* The files and directories used by Git, Mercurial and Bazaar to
store their information are now excluded by the defaultexcludes.
Bugzilla Report 49624.

Fixed bugs:
-----------



+ 18
- 1
docs/manual/dirtasks.html View File

@@ -265,7 +265,7 @@ as an implicit fileset.</p>

<h3><a name="defaultexcludes">Default Excludes</a></h3>
<p>There are a set of definitions that are excluded by default from all
directory-based tasks. They are:</p>
directory-based tasks. As of Ant 1.8.1 they are:</p>
<pre>
**/*~
**/#*#
@@ -282,6 +282,23 @@ directory-based tasks. They are:</p>
**/.svn/**
**/.DS_Store
</pre>
<p>Ant 1.8.2 adds the folllowing default excludes:</p>
<pre>
**/.git
**/.git/**
**/.gitattributes
**/.gitignore
**/.gitmodules
**/.hg
**/.hg/**
**/.hgignore
**/.hgsub
**/.hgsubstate
**/.hgtags
**/.bzr
**/.bzr/**
**/.bzrignore
</pre>
<p>If you do not want these default excludes applied, you may disable
them with the <code>defaultexcludes=&quot;no&quot;</code>
attribute.</p>


+ 20
- 0
src/main/org/apache/tools/ant/DirectoryScanner.java View File

@@ -170,6 +170,26 @@ public class DirectoryScanner
SelectorUtils.DEEP_TREE_MATCH + "/.svn",
SelectorUtils.DEEP_TREE_MATCH + "/.svn/" + SelectorUtils.DEEP_TREE_MATCH,

// Git
SelectorUtils.DEEP_TREE_MATCH + "/.git",
SelectorUtils.DEEP_TREE_MATCH + "/.git/" + SelectorUtils.DEEP_TREE_MATCH,
SelectorUtils.DEEP_TREE_MATCH + "/.gitattributes",
SelectorUtils.DEEP_TREE_MATCH + "/.gitignore",
SelectorUtils.DEEP_TREE_MATCH + "/.gitmodules",

// Mercurial
SelectorUtils.DEEP_TREE_MATCH + "/.hg",
SelectorUtils.DEEP_TREE_MATCH + "/.hg/" + SelectorUtils.DEEP_TREE_MATCH,
SelectorUtils.DEEP_TREE_MATCH + "/.hgignore",
SelectorUtils.DEEP_TREE_MATCH + "/.hgsub",
SelectorUtils.DEEP_TREE_MATCH + "/.hgsubstate",
SelectorUtils.DEEP_TREE_MATCH + "/.hgtags",

// Bazaar
SelectorUtils.DEEP_TREE_MATCH + "/.bzr",
SelectorUtils.DEEP_TREE_MATCH + "/.bzr/" + SelectorUtils.DEEP_TREE_MATCH,
SelectorUtils.DEEP_TREE_MATCH + "/.bzrignore",

// Mac
SelectorUtils.DEEP_TREE_MATCH + "/.DS_Store"
};


+ 42
- 0
src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java View File

@@ -53,6 +53,20 @@ public class DefaultExcludesTest extends BuildFileTest {
"**/vssver.scc",
"**/.svn",
"**/.svn/**",
"**/.git",
"**/.git/**",
"**/.gitattributes",
"**/.gitignore",
"**/.gitmodules",
"**/.hg",
"**/.hg/**",
"**/.hgignore",
"**/.hgsub",
"**/.hgsubstate",
"**/.hgtags",
"**/.bzr",
"**/.bzr/**",
"**/.bzrignore",
"**/.DS_Store"};
project.executeTarget("test1");
assertEquals("current default excludes", expected, DirectoryScanner.getDefaultExcludes());
@@ -74,6 +88,20 @@ public class DefaultExcludesTest extends BuildFileTest {
"**/vssver.scc",
"**/.svn",
"**/.svn/**",
"**/.git",
"**/.git/**",
"**/.gitattributes",
"**/.gitignore",
"**/.gitmodules",
"**/.hg",
"**/.hg/**",
"**/.hgignore",
"**/.hgsub",
"**/.hgsubstate",
"**/.hgtags",
"**/.bzr",
"**/.bzr/**",
"**/.bzrignore",
"**/.DS_Store",
"foo"};
project.executeTarget("test2");
@@ -96,6 +124,20 @@ public class DefaultExcludesTest extends BuildFileTest {
"**/vssver.scc",
"**/.svn",
"**/.svn/**",
"**/.git",
"**/.git/**",
"**/.gitattributes",
"**/.gitignore",
"**/.gitmodules",
"**/.hg",
"**/.hg/**",
"**/.hgignore",
"**/.hgsub",
"**/.hgsubstate",
"**/.hgtags",
"**/.bzr",
"**/.bzr/**",
"**/.bzrignore",
"**/.DS_Store"};
project.executeTarget("test3");
assertEquals("current default excludes", expected, DirectoryScanner.getDefaultExcludes());


Loading…
Cancel
Save