Patchwork [2,of,3] streamclone: comment why path auditing is disabled in generatev1()

login
register
mail settings
Submitter Yuya Nishihara
Date July 7, 2017, 3:14 p.m.
Message ID <4249fe0f2a768bd556bd.1499440442@mimosa>
Download mbox | patch
Permalink /patch/22101/
State Accepted
Headers show

Comments

Yuya Nishihara - July 7, 2017, 3:14 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1499437171 -32400
#      Fri Jul 07 23:19:31 2017 +0900
# Node ID 4249fe0f2a768bd556bd8e69e1b62baa20594190
# Parent  975c99e7fc675b5f1f89b348cc91651e0d48eb61
streamclone: comment why path auditing is disabled in generatev1()

Copied from 39c6e349dfff. I wasn't sure whether it's for optimization or
suppressing unwanted error.

Patch

diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -221,6 +221,8 @@  def generatev1(repo):
                 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
             # partially encode name over the wire for backwards compat
             yield '%s\0%d\n' % (store.encodedir(name), size)
+            # auditing at this stage is both pointless (paths are already
+            # trusted by the local repo) and expensive
             with svfs(name, 'rb', auditpath=False) as fp:
                 if size <= 65536:
                     yield fp.read(size)