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

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Thu Jul 23 15:00:17 UTC 2015


http://bz.selenic.com/show_bug.cgi?id=4759

          Priority: normal
            Bug ID: 4759
                CC: mercurial-devel at selenic.com
          Assignee: bugzilla at selenic.com
           Summary: 'include:' rules only work if cwd is the root of the
                    repo
          Severity: bug
    Classification: Unclassified
                OS: Windows
          Reporter: matt_harbison at yahoo.com
          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.

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

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list