Bug 4473 - ignore path is relative to current directory
Summary: ignore path is relative to current directory
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 3.2.1
Hardware: Macintosh Mac OS
: normal bug
Assignee: Siddharth Agarwal
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-15 12:32 UTC by Alexander Regueiro
Modified: 2015-01-22 15:04 UTC (History)
5 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 Alexander Regueiro 2014-12-15 12:32 UTC
Any path specified as an "ignore" value in the UI section of an hgrc file is interpreted as relative to the current directory, when it really makes a lot more sense (and is certainly more useful to repository maintainers) to make it relative to the hgrc file itself. This ensures more predictable and reliable behaviour.

For example, consider the situation specified in http://mercurial.selenic.com/wiki/TipsAndTricks#Ignore_files_in_local_working_copy_only. The problem mentioned in the bracketed sentence (of having to specify the absolute path to a repo-specific user hgignore file) would be solved by the proposed relative path behaviour.
Comment 2 Alexander Regueiro 2014-12-16 15:57 UTC
(In reply to comment #1)

Interesting. I'm glad there's been support for this before. I'd imagine the change in code is a relatively straightforward one?

As suggested in the mailing list posts, maybe we can change default behaviour so that relative paths are either with respect to the repository root, or the directory of the hgrc file. Alternatively, or in addition, one could specify something like an HG_DIR or HG_ROOT environment variable that can be used in hgrc files – this is akin to the GIT_DIR environment variable that performs the same role for Git repositories.
Comment 3 HG Bot 2014-12-22 18:31 UTC
Fixed by http://selenic.com/repo/hg/rev/a04c7b74b3d5
Siddharth Agarwal <sid0@fb.com>
ignore: resolve ignore files relative to repo root (issue4473) (BC)

Previously these would be considered to be relative to the current working
directory. That behavior is both undocumented and doesn't really make sense.
There are two reasonable options for how to resolve relative paths:
- relative to the repo root
- relative to the config file

Resolving these files relative to the repo root matches existing behavior with
hooks. An earlier discussion about this is available at
http://mercurial.markmail.org/thread/tvu7yhzsiywgkjzl.

Thanks to Isaac Jurado <diptongo@gmail.com> for the initial patchset that
spurred the discussion.

(please test the fix)
Comment 4 Matt Mackall 2015-01-22 15:04 UTC
Bulk testing -> fixed