Index: tests/git_common_test.py |
diff --git a/tests/git_common_test.py b/tests/git_common_test.py |
index e7ec3b425f4235f8de54082a6b67d5dfd96c17e6..ef411ce9dab51ffb9c807eed301c910cbbad8725 100755 |
--- a/tests/git_common_test.py |
+++ b/tests/git_common_test.py |
@@ -8,6 +8,7 @@ |
import binascii |
import collections |
import os |
+import shutil |
import signal |
import sys |
import tempfile |
@@ -743,6 +744,35 @@ class GitFreezeThaw(git_test_utils.GitRepoReadWriteTestBase): |
self.repo.run(inner) |
+class GitMakeWorkdir(git_test_utils.GitRepoReadOnlyTestBase, GitCommonTestBase): |
+ def setUp(self): |
+ self._tempdir = tempfile.mkdtemp() |
+ |
+ def tearDown(self): |
+ shutil.rmtree(self._tempdir) |
+ |
+ REPO_SCHEMA = """ |
+ A |
+ """ |
+ |
+ def testMakeWorkdir(self): |
+ if not hasattr(os, 'symlink'): |
+ return |
+ |
+ workdir = os.path.join(self._tempdir, 'workdir') |
+ self.gc.make_workdir(os.path.join(self.repo.repo_path, '.git'), |
+ os.path.join(workdir, '.git')) |
+ EXPECTED_LINKS = [ |
+ 'config', 'info', 'hooks', 'logs/refs', 'objects', 'refs', |
+ ] |
+ for path in EXPECTED_LINKS: |
+ self.assertTrue(os.path.islink(os.path.join(workdir, '.git', path))) |
+ self.assertEqual(os.path.realpath(os.path.join(workdir, '.git', path)), |
+ os.path.join(self.repo.repo_path, '.git', path)) |
+ self.assertFalse(os.path.islink(os.path.join(workdir, '.git', 'HEAD'))) |
+ |
+ |
+ |
if __name__ == '__main__': |
sys.exit(coverage_utils.covered_main( |
os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py'))) |