diff --git a/mercurial/configitems.py b/mercurial/configitems.py index a49e30f163..42ac7368c9 100644 --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -998,6 +998,9 @@ coreconfigitem('ui', 'formatjson', coreconfigitem('ui', 'formatted', default=None, ) +coreconfigitem('ui', 'gitignore', + default=False, +) coreconfigitem('ui', 'graphnodetemplate', default=None, ) diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py index f84fa47b76..1d157b8442 100644 --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -164,7 +164,10 @@ class dirstate(object): @rootcache('.hgignore') def _ignore(self): files = self._ignorefiles() - gitignore = matchmod.gitignorematcher(self._root, '') + if self._ui.configbool('ui', 'gitignore'): + gitignore = matchmod.gitignorematcher(self._root, '') + else: + gitignore = matchmod.nevermatcher(self._root, '') if not files: return gitignore diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt index 50212102be..109bbfb0b5 100644 --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -2084,6 +2084,9 @@ User interface controls. Encoding to try if it's not possible to decode the changelog using UTF-8. (default: ISO-8859-1) +``gitignore`` + Respect gitignore or not. (default: False) + ``graphnodetemplate`` The template used to print changeset nodes in an ASCII revision graph. (default: ``{graphnode}``) diff --git a/tests/test-gitignore.t b/tests/test-gitignore.t index f60da7bfd6..9fc60b1683 100644 --- a/tests/test-gitignore.t +++ b/tests/test-gitignore.t @@ -1,4 +1,5 @@ $ newrepo + $ setconfig ui.gitignore=1 $ cat > .gitignore << EOF > *.tmp diff --git a/tests/test-hgignore.t b/tests/test-hgignore.t index 032e0fb622..bdd09e1315 100644 --- a/tests/test-hgignore.t +++ b/tests/test-hgignore.t @@ -3,9 +3,12 @@ gitignore is used when there is no hgignore: - $ hg debugignore + $ hg debugignore --config ui.gitignore=1 + $ hg debugignore --config ui.gitignore=0 + + Issue562: .hgignore requires newline at end: $ touch foo @@ -197,9 +200,12 @@ Test relative ignore path (issue4473): $ hg status . A b.o - $ hg debugignore + $ hg debugignore --config ui.gitignore=1 , ]> + $ hg debugignore + , ]> + $ hg debugignore b.o b.o is ignored (ignore rule in $TESTTMP/ignorerepo/.hgignore, line 1: '*') (glob)