Patchwork [Bug,4759] New: 'include:' rules only work if cwd is the root of the repo

mail settings
Date July 23, 2015, 3 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/10055/
State Not Applicable
Delegated to: Matt Mackall
Headers show

Comments - July 23, 2015, 3 p.m.

          Priority: normal
            Bug ID: 4759
           Summary: 'include:' rules only work if cwd is the root of the
          Severity: bug
    Classification: Unclassified
                OS: Windows
          Hardware: PC
            Status: UNCONFIRMED
           Version: 3.5-rc
         Component: Mercurial
           Product: Mercurial

I noticed this issue when cwd was outside of the repo and -R was specified.  In
this case, the file referenced by 'include:' isn't read, so the additional
rules aren't applied.

This is a diff of a test showing the same issue on 3.5-rc (but deep inside the
repo).  The test file used 'hg init' without specifying a repo name, so I
couldn't specify the repo name.  'foo.included' should be ignored here, as it
was in the previous test where cwd was the root of the repo.

I thought it was strange that the matcher created in dirstate._ignore always
passes '' as cwd instead of self.getcwd(), but getcwd() broke ignore files
without 'include:' when not at the root of the repo.


diff --git a/tests/test-hgignore.t b/tests/test-hgignore.t
--- a/tests/test-hgignore.t
+++ b/tests/test-hgignore.t
@@ -183,6 +183,15 @@  Check using 'include:' in ignore file
   ? .hgignore
   ? otherignore

+  $ cd dir
+  $ hg status
+  skipping unreadable pattern file 'otherignore': No such file or directory
+  A dir/b.o
+  ? .hgignore
+  ? foo.included
+  ? otherignore
+  $ cd ..
 Check recursive uses of 'include:'

   $ echo "include:nestedignore" >> otherignore