Compare commits

..

8 commits

Author SHA1 Message Date
a711af3ec8
Revert "Смена относительного пути проекта на абсолютный, который исправляет проблему при работе с проектом во время добавления/восстановления"
Выявлены проблемы при добавлении в индекс. Использование утилиты на Windows показало, что при добавлении полный путь вызывает ошибку, так как он идентифицируется за пределами проекта.
Решено использовать в рамках конктекста "-C </path/to/project>" добавление как "add ." отсносительно корня проекта.

This reverts commit ee41d5f96d.
2025-06-02 19:35:51 +03:00
4277eb752b
Обновление до версии 0.1.0-alpha.2 2025-06-02 18:10:31 +03:00
80ace62abf
Указан явный путь к рабочей директории проекта при вызове команды git, так как вызов snag из под не рабочей директории не выполнял некоторые операции на старых версиях git 2025-06-02 00:59:27 +03:00
ee41d5f96d
Смена относительного пути проекта на абсолютный, который исправляет проблему при работе с проектом во время добавления/восстановления 2025-06-02 00:26:38 +03:00
e43b792df8
Добавлена информация для фидбэка при возникновении непредвиденных ошибок 2025-05-30 19:11:31 +03:00
552b635b59
- Корректный вывод пути файла/директории при вызове status
- Добавлен вывод секунд при вызове info
2025-05-30 19:07:09 +03:00
8a64320214
В библиотеку добавлена функция разбития строки по первому символу пробела 2025-05-30 19:06:29 +03:00
a74579d709
Исправление загодочных иероглифов 2025-05-29 22:25:12 +03:00
6 changed files with 21 additions and 11 deletions

View file

@ -93,7 +93,7 @@ snag restore [-h] [--no-pre] [--no-post] <snapshot_hash>
```
- `--no-pre` — Skips pre-commands.
- `--no-post`焦性
- `--no-post` Skips post-commands.
- `<snapshot_hash>` — Hash of the snapshot to restore.
### `snag list`

View file

@ -237,7 +237,9 @@ int main(string[] args)
return EXIT_FAILURE;
} catch (Exception e) {
writeln(
"AN UNEXPECTED ERROR HAS OCCURRED! PLEASE REPORT IT TO THE AUTHOR OF THE SNAG!\n\n",
"AN UNEXPECTED ERROR HAS OCCURRED!\n",
"PLEASE REPORT IT TO THE AUTHOR OF THE SNAG: ",
"alexander@zhirov.kz (Alexander Zhirov)\n\n",
e
);
return EXIT_FAILURE;

View file

@ -22,8 +22,8 @@ class Snag {
this(SnagConfig config) {
_baseCommand = format(
"git --git-dir=%s --work-tree=%s",
config.git, config.project
"git -C %s --git-dir=%s --work-tree=%s",
config.project, config.git, config.project
).split();
_config = config;
@ -131,7 +131,7 @@ class Snag {
}
writeln("The following list of files requires backup:");
result.output.split('\n')[0..$-1].map!(e =>
e.strip.split
e.strip.splitByFirstSpace
).each!(e =>
writefln("\t%s\t/%s", gitStatus(e[0], true), e[1])
);
@ -250,7 +250,7 @@ class Snag {
[
"log",
"--all",
"--date=format:%Y.%m.%d %H:%M",
"--date=format:%Y.%m.%d %H:%M:%S",
"--pretty=" ~ format
],
"Failed to retrieve the list of snapshots"
@ -381,8 +381,8 @@ class Snag {
// Выполнение git команд относительно распакованного архива
string[] customCommand = format(
"git --git-dir=%s --work-tree=%s",
_config.git, tempDirectory
"git -C %s --git-dir=%s --work-tree=%s",
tempDirectory, _config.git, tempDirectory
).split();
// Необходимо проверить, что текущее состояние файлов не идентично файлам распакованного архива

View file

@ -75,8 +75,8 @@ class SnagRules {
_gitignoreBak = _gitignore ~ ".bak";
_baseCommand = format(
"git --git-dir=%s --work-tree=%s",
config.git, config.project
"git -C %s --git-dir=%s --work-tree=%s",
config.project, config.git, config.project
).split();
generate();

View file

@ -2,6 +2,8 @@ module snag.lib.lib;
import std.regex;
import std.process;
import std.algorithm;
import std.string;
bool isValidHash(string hash) {
auto hashPattern = ctRegex!r"^[a-fA-F0-9]{7}$";
@ -17,3 +19,9 @@ bool checkGit() {
auto result = execute(["which", "git"]);
return !result.status;
}
string[] splitByFirstSpace(string line) {
auto spaceIndex = line.indexOf(' ');
return spaceIndex == -1 ?
[line] : [line[0 .. spaceIndex], line[spaceIndex + 1..$]];
}

View file

@ -1,3 +1,3 @@
module snag.version_;
enum snagVersion = "0.1.0-alpha.1";
enum snagVersion = "0.1.0-alpha.2";