mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +01:00
In Arcanist, when trying to write to a file configuration source, create missing directories
Summary: The ".git/arc" directory may need to be created when writing to working copy configuration. Test Plan: - Tried to store an answer to a prompt in a new working copy. - Before: error that ".git/arc" does not exist. - After: prompt saved to working copy configuration. Differential Revision: https://secure.phabricator.com/D21588
This commit is contained in:
parent
953d742a1a
commit
2d6452acb5
1 changed files with 14 additions and 1 deletions
|
@ -39,7 +39,20 @@ abstract class ArcanistFilesystemConfigurationSource
|
|||
$content = id(new PhutilJSON())
|
||||
->encodeFormatted($values);
|
||||
|
||||
Filesystem::writeFile($this->path, $content);
|
||||
$path = $this->path;
|
||||
|
||||
// If the containing directory does not exist yet, create it.
|
||||
//
|
||||
// This is expected when (for example) you first write to project
|
||||
// configuration in a Git working copy: the ".git/arc" directory will
|
||||
// not exist yet.
|
||||
|
||||
$dir = dirname($path);
|
||||
if (!Filesystem::pathExists($dir)) {
|
||||
Filesystem::createDirectory($dir, 0755, $recursive = true);
|
||||
}
|
||||
|
||||
Filesystem::writeFile($path, $content);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue