Bug 5222 - debugignore and `status -i` don't always agree
Summary: debugignore and `status -i` don't always agree
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 3.8-rc
Hardware: PC All
: wish feature
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-28 15:37 UTC by Matt Harbison
Modified: 2017-10-16 00:00 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Harbison 2016-04-28 15:37 UTC
When run from a place other than the repo root, debugignore may say ignored files aren't really ignored.  I originally thought it was always an issue from the sub directory, but it does pick up patterns without a path.  It seems to want a path from the root of the repo regardless of cwd, but that isn't obvious from the help, nor is it consistent with file handling for other commands.

STR:

  $ hg init r2
  $ cd r2
  $ cat >> .hgignore <<EOF
  > syntax: glob
  > **.c
  > dir/foo.b
  > EOF
  $ hg ci -Aqm hgignore
  $ mkdir dir
  $ touch dir/foo.c dir/foo.b

OK from the root dir
  $ hg st -i
  I dir/foo.b
  I dir/foo.c
  $ hg debugignore dir/foo.c
  dir/foo.c is ignored
  (ignore rule in $TESTTMP\r2\.hgignore, line 2: '**.c')
  $ hg debugignore dir/foo.b
  dir/foo.b is ignored
  (ignore rule in $TESTTMP\r2\.hgignore, line 3: 'dir/foo.b')
  $ cd dir

Path pattern is incorrect
  $ hg st -i
  I dir/foo.b
  I dir/foo.c
  $ hg debugignore foo.c
  foo.c is ignored
  (ignore rule in $TESTTMP\r2\.hgignore, line 2: '**.c')
  $ hg debugignore foo.b
  foo.b is not ignored

Full path works as expected
  $ hg debugignore dir/foo.b
  dir/foo.b is ignored
  (ignore rule in $TESTTMP\r2\.hgignore, line 3: 'dir/foo.b')
Comment 1 Yuya Nishihara 2016-04-28 23:56 UTC
Maybe debugignore have to use matcher.
Comment 2 Bugzilla 2017-02-01 00:00 UTC
Bug was inactive for 278 days, archiving
Comment 3 HG Bot 2017-10-04 18:00 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/e9672de52a23
Matt Harbison <matt_harbison@yahoo.com>
debugignore: eliminate inconsistencies with `hg status` (issue5222)

Using a matcher for this command allows processing the named file(s) as
relative to cwd.  It also leverages the icasefs normalization logic the same
way the status command does.  (However, a false indicator is given for a
nonexistent file in some cases, e.g. passing 'foo.REJ' when that file doesn't
exist, and the rule is '*.rej'.  Maybe the regex itself needs to be case
insensitive on these platforms, at least for the debug command.)  Finally, the
file printed is relative to cwd and uses platform specific slashes, so a few
(glob)s were needed in seemingly unrelated tests.

(please test the fix)
Comment 4 Bugzilla 2017-10-16 00:00 UTC
Bug was set to TESTING for 11 days, resolving