Skip to content
Snippets Groups Projects
Commit 0d87b1caed92 authored by Mads Kiilerich's avatar Mads Kiilerich
Browse files

posix: move checklink test file to .hg/cache

This avoids unnecessary churn in the working directory.

It is not necessarily a fully valid assumption that .hg/cache is on the same
filesystem as the working directory, but I think it is an acceptable
approximation. It could also be the case that different parts of the working
directory is on different mount points so checking in the root folder could
also be wrong.
parent b324b4e431e5
No related branches found
No related tags found
No related merge requests found
......@@ -219,5 +219,11 @@
# mktemp is not racy because symlink creation will fail if the
# file already exists
while True:
name = tempfile.mktemp(dir=path, prefix='hg-checklink-')
cachedir = os.path.join(path, '.hg', 'cache')
if os.path.isdir(cachedir):
checkdir = cachedir
else:
checkdir = path
cachedir = None
name = tempfile.mktemp(dir=checkdir, prefix='checklink-')
try:
......@@ -223,5 +229,6 @@
try:
fd = tempfile.NamedTemporaryFile(dir=path, prefix='hg-checklink-')
fd = tempfile.NamedTemporaryFile(dir=checkdir,
prefix='hg-checklink-')
try:
os.symlink(os.path.basename(fd.name), name)
os.unlink(name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment