changeset 40793:64cdfcc73706

cache: create `cache` directory at init time The cache directory will be needed very quickly, so it seems simpler to create it early to make sure it has the same owner and permission than the other directory in the repository.
author Boris Feld <boris.feld@octobus.net>
date Thu, 15 Nov 2018 02:38:55 +0100
parents 47e3f554df35
children d5622dfe4ba3
files mercurial/localrepo.py tests/test-empty.t tests/test-inherit-mode.t
diffstat 3 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Nov 15 17:08:23 2018 +0100
+++ b/mercurial/localrepo.py	Thu Nov 15 02:38:55 2018 +0100
@@ -3010,6 +3010,8 @@
         wdirvfs.makedirs()
 
     hgvfs.makedir(notindexed=True)
+    if 'sharedrepo' not in createopts:
+        hgvfs.mkdir(b'cache')
 
     if b'store' in requirements and 'sharedrepo' not in createopts:
         hgvfs.mkdir(b'store')
--- a/tests/test-empty.t	Thu Nov 15 17:08:23 2018 +0100
+++ b/tests/test-empty.t	Thu Nov 15 02:38:55 2018 +0100
@@ -20,6 +20,7 @@
 
   $ ls .hg
   00changelog.i
+  cache
   requires
   store
 
--- a/tests/test-inherit-mode.t	Thu Nov 15 17:08:23 2018 +0100
+++ b/tests/test-inherit-mode.t	Thu Nov 15 02:38:55 2018 +0100
@@ -42,7 +42,7 @@
   $ hg init repo
   $ cd repo
 
-  $ chmod 0770 .hg/store
+  $ chmod 0770 .hg/store .hg/cache
 
 before commit
 store can be written by the group, other files cannot
@@ -51,6 +51,7 @@
   $ "$PYTHON" ../printmodes.py .
   00700 ./.hg/
   00600 ./.hg/00changelog.i
+  00770 ./.hg/cache/
   00600 ./.hg/requires
   00770 ./.hg/store/
 
@@ -116,6 +117,7 @@
   $ "$PYTHON" ../printmodes.py ../push
   00770 ../push/.hg/
   00660 ../push/.hg/00changelog.i
+  00770 ../push/.hg/cache/
   00660 ../push/.hg/requires
   00770 ../push/.hg/store/