tests/test-empty-dir.t
author Matt Harbison <matt_harbison@yahoo.com>
Thu, 17 Jul 2014 20:17:17 -0400
changeset 21917 ac3b3a2d976d
parent 12346 3b165c127690
permissions -rw-r--r--
largefiles: avoid unnecessary creation of .hg/largefiles when opening lfdirstate Previously, the directory '.hg/largefiles' would always be created if it didn't exist when the lfdirstate was opened. If there were no standin files, no dirstate file would be created in the directory. The end result was that enabling the largefiles extension globally, but not explicitly adding a largefile would result in the repository eventually sprouting this directory. Creation of this directory effectively changes readonly operations like summary and status into operations that require write access. Without write access, commands that would succeed without the extension loaded would abort with a surprising error when the extension is loaded, but not actively used: $ hg sum -R /tmp/thg --config extensions.largefiles= parent: 16541:00dc703d5aed repowidget: specify incoming bundle by plain file path to avoid url parsing branch: default abort: Permission denied: '/tmp/thg/.hg/largefiles' This change is simpler than changing the callers of openlfdirstate() to use the 'create' parameter that was introduced in ae57920ac188, and probably how that should have been implemented in the first place.

  $ hg init

  $ echo 123 > a
  $ hg add a
  $ hg commit -m "first" a

  $ mkdir sub
  $ echo 321 > sub/b
  $ hg add sub/b
  $ hg commit -m "second" sub/b

  $ cat sub/b
  321

  $ hg co 0
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved

  $ cat sub/b 2>/dev/null || echo "sub/b not present"
  sub/b not present

  $ test -d sub || echo "sub not present"
  sub not present