Добавлена возможность инициализации репозитория с перезаписью существующего через флаг force
This commit is contained in:
parent
35a7b26a4a
commit
db9a6be9f4
2 changed files with 14 additions and 4 deletions
|
@ -44,13 +44,18 @@ class Snag {
|
|||
return result;
|
||||
}
|
||||
|
||||
void initialize() {
|
||||
void initialize(bool force) {
|
||||
auto result = execute(_baseCommand ~ ["rev-parse", "--git-dir"]);
|
||||
!result.status &&
|
||||
!force && !result.status &&
|
||||
throw new SnagException(
|
||||
"The Git repository has already been initialized: "
|
||||
~ result.output.strip('\n')
|
||||
);
|
||||
|
||||
force && _config.git.exists
|
||||
&& _config.git.isDir
|
||||
&& _config.git.rmdirRecurse;
|
||||
|
||||
git(
|
||||
["init", "--initial-branch=default"],
|
||||
"A Git repository initialization error occurred"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue