D5361: rebase: fix path auditing to audit path relative to repo root

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Dec 3 22:10:39 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch, when rebasing a file called "foo/bar", we would
  check e.g. if "/foo" (i.e. rooted at the file system root) was a
  symlink. That's clearly not what we meant to do. I haven't added a
  test case because I don't know to test it.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5361

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1848,8 +1848,8 @@
                 fail(path, component)
 
         # Test the other direction -- that this path from p2 isn't a directory
-        # in p1 (test that p1 doesn't any paths matching `path/*`).
-        match = matchmod.match('/', '', [path + '/'], default=b'relpath')
+        # in p1 (test that p1 doesn't have any paths matching `path/*`).
+        match = self.match(pats=[path + '/'], default=b'relpath')
         matches = self.p1().manifest().matches(match)
         mfiles = matches.keys()
         if len(mfiles) > 0:



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list