Compare commits
2 commits
e43b792df8
...
80ace62abf
Author | SHA1 | Date | |
---|---|---|---|
80ace62abf | |||
ee41d5f96d |
2 changed files with 12 additions and 12 deletions
|
@ -22,8 +22,8 @@ class Snag {
|
||||||
|
|
||||||
this(SnagConfig config) {
|
this(SnagConfig config) {
|
||||||
_baseCommand = format(
|
_baseCommand = format(
|
||||||
"git --git-dir=%s --work-tree=%s",
|
"git -C %s --git-dir=%s --work-tree=%s",
|
||||||
config.git, config.project
|
config.project, config.git, config.project
|
||||||
).split();
|
).split();
|
||||||
|
|
||||||
_config = config;
|
_config = config;
|
||||||
|
@ -158,7 +158,7 @@ class Snag {
|
||||||
result = execute(_baseCommand ~ ["rev-parse", "--short", "HEAD"]);
|
result = execute(_baseCommand ~ ["rev-parse", "--short", "HEAD"]);
|
||||||
if (result.status == 128) {
|
if (result.status == 128) {
|
||||||
// Если это самый первый коммит после инициализации репозитория
|
// Если это самый первый коммит после инициализации репозитория
|
||||||
git(["add", "."], "Failed to prepare files for archiving");
|
git(["add", _config.project], "Failed to prepare files for archiving");
|
||||||
git(["commit", "-m"] ~ message, "Failed to create a snapshot");
|
git(["commit", "-m"] ~ message, "Failed to create a snapshot");
|
||||||
newSnapshot = git(
|
newSnapshot = git(
|
||||||
["rev-parse", "--short", "HEAD"],
|
["rev-parse", "--short", "HEAD"],
|
||||||
|
@ -197,7 +197,7 @@ class Snag {
|
||||||
"Failed to create a branch from the current state"
|
"Failed to create a branch from the current state"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
["add", "."],
|
["add", _config.project],
|
||||||
"Failed to prepare files for archiving"
|
"Failed to prepare files for archiving"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
|
@ -211,7 +211,7 @@ class Snag {
|
||||||
} else {
|
} else {
|
||||||
// Если коммит является посленим в ветке
|
// Если коммит является посленим в ветке
|
||||||
git(
|
git(
|
||||||
["add", "."],
|
["add", _config.project],
|
||||||
"Failed to prepare files for archiving"
|
"Failed to prepare files for archiving"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
|
@ -273,7 +273,7 @@ class Snag {
|
||||||
);
|
);
|
||||||
if (result.output.length) {
|
if (result.output.length) {
|
||||||
git(
|
git(
|
||||||
["restore", "."],
|
["restore", _config.project],
|
||||||
"Failed to reset file changes state"
|
"Failed to reset file changes state"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
|
@ -381,8 +381,8 @@ class Snag {
|
||||||
|
|
||||||
// Выполнение git команд относительно распакованного архива
|
// Выполнение git команд относительно распакованного архива
|
||||||
string[] customCommand = format(
|
string[] customCommand = format(
|
||||||
"git --git-dir=%s --work-tree=%s",
|
"git -C %s --git-dir=%s --work-tree=%s",
|
||||||
_config.git, tempDirectory
|
tempDirectory, _config.git, tempDirectory
|
||||||
).split();
|
).split();
|
||||||
|
|
||||||
// Необходимо проверить, что текущее состояние файлов не идентично файлам распакованного архива
|
// Необходимо проверить, что текущее состояние файлов не идентично файлам распакованного архива
|
||||||
|
@ -406,7 +406,7 @@ class Snag {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Создание нового снимка на основе состояния файлов из распакованного архива
|
// Создание нового снимка на основе состояния файлов из распакованного архива
|
||||||
result = execute(customCommand ~ ["add", "."]);
|
result = execute(customCommand ~ ["add", tempDirectory]);
|
||||||
result.status &&
|
result.status &&
|
||||||
throw new SnagException(
|
throw new SnagException(
|
||||||
"Failed to prepare files for archiving:\n"
|
"Failed to prepare files for archiving:\n"
|
||||||
|
@ -427,7 +427,7 @@ class Snag {
|
||||||
|
|
||||||
// Сброс состояния файлов
|
// Сброс состояния файлов
|
||||||
git(
|
git(
|
||||||
["restore", "."],
|
["restore", _config.project],
|
||||||
"Failed to reset file changes state"
|
"Failed to reset file changes state"
|
||||||
);
|
);
|
||||||
git(
|
git(
|
||||||
|
|
|
@ -75,8 +75,8 @@ class SnagRules {
|
||||||
_gitignoreBak = _gitignore ~ ".bak";
|
_gitignoreBak = _gitignore ~ ".bak";
|
||||||
|
|
||||||
_baseCommand = format(
|
_baseCommand = format(
|
||||||
"git --git-dir=%s --work-tree=%s",
|
"git -C %s --git-dir=%s --work-tree=%s",
|
||||||
config.git, config.project
|
config.project, config.git, config.project
|
||||||
).split();
|
).split();
|
||||||
|
|
||||||
generate();
|
generate();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue