diff --git a/CMakeLists.txt b/CMakeLists.txt index d84f74b..d9c4aa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,8 +47,12 @@ set(GIT2CPP_SRC ${GIT2CPP_SOURCE_DIR}/subcommand/checkout_subcommand.hpp ${GIT2CPP_SOURCE_DIR}/subcommand/clone_subcommand.cpp ${GIT2CPP_SOURCE_DIR}/subcommand/clone_subcommand.hpp + ${GIT2CPP_SOURCE_DIR}/subcommand/commit_subcommand.cpp + ${GIT2CPP_SOURCE_DIR}/subcommand/commit_subcommand.hpp ${GIT2CPP_SOURCE_DIR}/subcommand/init_subcommand.cpp ${GIT2CPP_SOURCE_DIR}/subcommand/init_subcommand.hpp + ${GIT2CPP_SOURCE_DIR}/subcommand/reset_subcommand.cpp + ${GIT2CPP_SOURCE_DIR}/subcommand/reset_subcommand.hpp ${GIT2CPP_SOURCE_DIR}/subcommand/status_subcommand.cpp ${GIT2CPP_SOURCE_DIR}/subcommand/status_subcommand.hpp ${GIT2CPP_SOURCE_DIR}/utils/common.cpp @@ -69,6 +73,8 @@ set(GIT2CPP_SRC ${GIT2CPP_SOURCE_DIR}/wrapper/refs_wrapper.hpp ${GIT2CPP_SOURCE_DIR}/wrapper/repository_wrapper.cpp ${GIT2CPP_SOURCE_DIR}/wrapper/repository_wrapper.hpp + ${GIT2CPP_SOURCE_DIR}/wrapper/signature_wrapper.cpp + ${GIT2CPP_SOURCE_DIR}/wrapper/signature_wrapper.hpp ${GIT2CPP_SOURCE_DIR}/wrapper/status_wrapper.cpp ${GIT2CPP_SOURCE_DIR}/wrapper/status_wrapper.hpp ${GIT2CPP_SOURCE_DIR}/wrapper/wrapper_base.hpp diff --git a/src/main.cpp b/src/main.cpp index ca92d6d..767e61a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,9 @@ #include "subcommand/branch_subcommand.hpp" #include "subcommand/checkout_subcommand.hpp" #include "subcommand/clone_subcommand.hpp" +#include "subcommand/commit_subcommand.hpp" #include "subcommand/init_subcommand.hpp" +#include "subcommand/reset_subcommand.hpp" #include "subcommand/status_subcommand.hpp" int main(int argc, char** argv) @@ -29,6 +31,8 @@ int main(int argc, char** argv) branch_subcommand branch(lg2_obj, app); checkout_subcommand checkout(lg2_obj, app); clone_subcommand clone(lg2_obj, app); + commit_subcommand commit(lg2_obj, app); + reset_subcommand reset(lg2_obj, app); app.require_subcommand(/* min */ 0, /* max */ 1); diff --git a/src/subcommand/add_subcommand.cpp b/src/subcommand/add_subcommand.cpp index cb2c609..9988d25 100644 --- a/src/subcommand/add_subcommand.cpp +++ b/src/subcommand/add_subcommand.cpp @@ -31,9 +31,11 @@ void add_subcommand::run() if (m_all_flag) { index.add_all(); + index.write(); } else { index.add_entries(m_add_files); + index.write(); } } diff --git a/src/subcommand/commit_subcommand.cpp b/src/subcommand/commit_subcommand.cpp new file mode 100644 index 0000000..b476100 --- /dev/null +++ b/src/subcommand/commit_subcommand.cpp @@ -0,0 +1,37 @@ +#include +#include + +#include "commit_subcommand.hpp" +#include "../wrapper/index_wrapper.hpp" +#include "../wrapper/repository_wrapper.hpp" + + +commit_subcommand::commit_subcommand(const libgit2_object&, CLI::App& app) +{ + auto *sub = app.add_subcommand("commit", "Record changes to the repository"); + + sub->add_option("-m,--message", m_commit_message, "Commit message"); + + sub->callback([this]() { this->run(); }); +}; + + +void commit_subcommand::run() +{ + auto directory = get_current_git_path(); + auto bare = false; + auto repo = repository_wrapper::init(directory, bare); + auto author_committer_signatures = signature_wrapper::get_default_signature_from_env(repo); + + if (m_commit_message.empty()) + { + std::cout << "Please enter a commit message:" << std::endl; + std::getline(std::cin, m_commit_message); + if (m_commit_message.empty()) + { + throw std::runtime_error("Aborting, no commit message specified."); + } + } + + repo.create_commit(author_committer_signatures, m_commit_message); +} diff --git a/src/subcommand/commit_subcommand.hpp b/src/subcommand/commit_subcommand.hpp new file mode 100644 index 0000000..8b29ccb --- /dev/null +++ b/src/subcommand/commit_subcommand.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include + +#include "../utils/common.hpp" + +class commit_subcommand +{ +public: + + explicit commit_subcommand(const libgit2_object&, CLI::App& app); + void run(); + +private: + std::string m_commit_message; +}; diff --git a/src/subcommand/reset_subcommand.cpp b/src/subcommand/reset_subcommand.cpp new file mode 100644 index 0000000..b862e78 --- /dev/null +++ b/src/subcommand/reset_subcommand.cpp @@ -0,0 +1,61 @@ +#include "reset_subcommand.hpp" +// #include "../wrapper/index_wrapper.hpp" +#include "../wrapper/repository_wrapper.hpp" +#include + +enum class reset_type +{ + GIT_RESET_SOFT = 1, + GIT_RESET_MIXED = 2, + GIT_RESET_HARD = 3 +}; + +reset_subcommand::reset_subcommand(const libgit2_object&, CLI::App& app) +{ + auto *sub = app.add_subcommand("reset", "Reset current HEAD to the specified state"); + + sub->add_option("", m_commit, "The ID of the commit that will become HEAD"); + + sub->add_flag("--soft", m_soft_flag, ""); + sub->add_flag("--mixed", m_mixed_flag, ""); + sub->add_flag("--hard", m_hard_flag, ""); + + sub->callback([this]() { this->run(); }); +}; + + +void reset_subcommand::run() +{ + auto directory = get_current_git_path(); + auto bare = false; + auto repo = repository_wrapper::init(directory, bare); + + auto target = repo.revparse_single(m_commit); + if (!target) + { + throw std::runtime_error("Target revision not found."); + } + + git_checkout_options options; + git_checkout_options_init(&options, GIT_CHECKOUT_OPTIONS_VERSION); + + git_reset_t reset_type; + if (m_soft_flag) + { + reset_type = GIT_RESET_SOFT; + } + if (m_mixed_flag) + { + reset_type = GIT_RESET_MIXED; + } + if (m_hard_flag) + { + reset_type = GIT_RESET_HARD; + if (m_commit.empty()) + { + m_commit = "HEAD"; + } + } + + repo.reset(target.value(), reset_type, options); +} diff --git a/src/subcommand/reset_subcommand.hpp b/src/subcommand/reset_subcommand.hpp new file mode 100644 index 0000000..bfddd43 --- /dev/null +++ b/src/subcommand/reset_subcommand.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include + +#include "../utils/common.hpp" + +class reset_subcommand +{ +public: + + explicit reset_subcommand(const libgit2_object&, CLI::App& app); + void run(); + +private: + std::string m_commit; + bool m_soft_flag = false; + bool m_mixed_flag = false; + bool m_hard_flag = false; +}; diff --git a/src/wrapper/commit_wrapper.cpp b/src/wrapper/commit_wrapper.cpp index 66fcd4f..bbd48b1 100644 --- a/src/wrapper/commit_wrapper.cpp +++ b/src/wrapper/commit_wrapper.cpp @@ -20,4 +20,3 @@ const git_oid& commit_wrapper::oid() const { return *git_commit_id(p_resource); } - diff --git a/src/wrapper/commit_wrapper.hpp b/src/wrapper/commit_wrapper.hpp index 201cbce..2cf2378 100644 --- a/src/wrapper/commit_wrapper.hpp +++ b/src/wrapper/commit_wrapper.hpp @@ -2,6 +2,7 @@ #include +#include "../wrapper/repository_wrapper.hpp" #include "../wrapper/wrapper_base.hpp" class commit_wrapper : public wrapper_base diff --git a/src/wrapper/index_wrapper.cpp b/src/wrapper/index_wrapper.cpp index 81b1c26..03e8afb 100644 --- a/src/wrapper/index_wrapper.cpp +++ b/src/wrapper/index_wrapper.cpp @@ -32,5 +32,17 @@ void index_wrapper::add_impl(std::vector patterns) { git_strarray_wrapper array{patterns}; throw_if_error(git_index_add_all(*this, array, 0, NULL, NULL)); + // throw_if_error(git_index_write(*this)); +} + +void index_wrapper::write() +{ throw_if_error(git_index_write(*this)); } + +git_oid index_wrapper::write_tree() +{ + git_oid tree_id; + throw_if_error(git_index_write_tree(&tree_id, *this)); + return tree_id; +} diff --git a/src/wrapper/index_wrapper.hpp b/src/wrapper/index_wrapper.hpp index f8c1282..2095fe0 100644 --- a/src/wrapper/index_wrapper.hpp +++ b/src/wrapper/index_wrapper.hpp @@ -20,6 +20,9 @@ class index_wrapper : public wrapper_base static index_wrapper init(repository_wrapper& rw); + void write(); + git_oid write_tree(); + void add_entries(std::vector patterns); void add_all(); diff --git a/src/wrapper/object_wrapper.cpp b/src/wrapper/object_wrapper.cpp index cea6175..bf21361 100644 --- a/src/wrapper/object_wrapper.cpp +++ b/src/wrapper/object_wrapper.cpp @@ -15,3 +15,8 @@ const git_oid& object_wrapper::oid() const { return *git_object_id(*this); } + +object_wrapper::operator git_commit*() const noexcept +{ + return reinterpret_cast(p_resource); +} diff --git a/src/wrapper/object_wrapper.hpp b/src/wrapper/object_wrapper.hpp index b0b86bf..bceab14 100644 --- a/src/wrapper/object_wrapper.hpp +++ b/src/wrapper/object_wrapper.hpp @@ -17,6 +17,8 @@ class object_wrapper : public wrapper_base const git_oid& oid() const; + operator git_commit*() const noexcept; + private: object_wrapper(git_object* obj); diff --git a/src/wrapper/repository_wrapper.cpp b/src/wrapper/repository_wrapper.cpp index 6be951d..6eb00f4 100644 --- a/src/wrapper/repository_wrapper.cpp +++ b/src/wrapper/repository_wrapper.cpp @@ -1,4 +1,6 @@ #include "../utils/git_exception.hpp" +#include "../wrapper/index_wrapper.hpp" +#include "../wrapper/object_wrapper.hpp" #include "../wrapper/repository_wrapper.hpp" repository_wrapper::~repository_wrapper() @@ -107,6 +109,35 @@ commit_wrapper repository_wrapper::find_commit(const git_oid& id) const return commit_wrapper(commit); } +void repository_wrapper::create_commit(const signature_wrapper::author_committer_signatures& author_committer_signatures, + const std::string& message) +{ + const char* message_encoding = "UTF-8"; + git_oid commit_id; + + std::string update_ref = "HEAD"; + auto parent = revparse_single(update_ref); + std::size_t parent_count = 0; + const git_commit* parents[1] = {nullptr}; + if (parent) + { + parent_count = 1; + parents[0] = *parent; + } + + git_tree* tree; + index_wrapper index = this->make_index(); + git_oid tree_id = index.write_tree(); + index.write(); + + throw_if_error(git_tree_lookup(&tree, *this, &tree_id)); + + throw_if_error(git_commit_create(&commit_id, *this, update_ref.c_str(), author_committer_signatures.first, author_committer_signatures.second, + message_encoding, message.c_str(), tree, parent_count, parents)); + + git_tree_free(tree); +} + annotated_commit_wrapper repository_wrapper::find_annotated_commit(const git_oid& id) const { git_annotated_commit* commit; @@ -130,3 +161,10 @@ void repository_wrapper::set_head_detached(const annotated_commit_wrapper& commi { throw_if_error(git_repository_set_head_detached_from_annotated(*this, commit)); } + +void repository_wrapper::reset(const object_wrapper& target, git_reset_t reset_type, const git_checkout_options& checkout_options) +{ + // TODO: gerer l'index + + throw_if_error(git_reset(*this, target, reset_type, &checkout_options)); +} diff --git a/src/wrapper/repository_wrapper.hpp b/src/wrapper/repository_wrapper.hpp index 8d44aed..7258724 100644 --- a/src/wrapper/repository_wrapper.hpp +++ b/src/wrapper/repository_wrapper.hpp @@ -13,6 +13,7 @@ #include "../wrapper/index_wrapper.hpp" #include "../wrapper/object_wrapper.hpp" #include "../wrapper/refs_wrapper.hpp" +#include "../wrapper/signature_wrapper.hpp" #include "../wrapper/wrapper_base.hpp" class repository_wrapper : public wrapper_base @@ -50,6 +51,7 @@ class repository_wrapper : public wrapper_base // Commits commit_wrapper find_commit(std::string_view ref_name = "HEAD") const; commit_wrapper find_commit(const git_oid& id) const; + void create_commit(const signature_wrapper::author_committer_signatures&, const std::string&); // Annotated commits annotated_commit_wrapper find_annotated_commit(const git_oid& id) const; @@ -60,9 +62,10 @@ class repository_wrapper : public wrapper_base // Objects std::optional revparse_single(std::string_view spec) const; - // Set head + // Head manipulations void set_head(std::string_view ref_name); void set_head_detached(const annotated_commit_wrapper& commit); + void reset(const object_wrapper& target, git_reset_t reset_type, const git_checkout_options& checkout_options); private: diff --git a/src/wrapper/signature_wrapper.cpp b/src/wrapper/signature_wrapper.cpp new file mode 100644 index 0000000..4bbb7a6 --- /dev/null +++ b/src/wrapper/signature_wrapper.cpp @@ -0,0 +1,17 @@ +#include "../wrapper/repository_wrapper.hpp" +#include "../wrapper/signature_wrapper.hpp" +#include "../utils/git_exception.hpp" + +signature_wrapper::~signature_wrapper() +{ + git_signature_free(p_resource); + p_resource=nullptr; +} + +signature_wrapper::author_committer_signatures signature_wrapper::get_default_signature_from_env(repository_wrapper& rw) +{ + signature_wrapper author; + signature_wrapper committer; + throw_if_error(git_signature_default_from_env(&(author.p_resource), &(committer.p_resource), rw)); + return {std::move(author), std::move(committer)}; +} diff --git a/src/wrapper/signature_wrapper.hpp b/src/wrapper/signature_wrapper.hpp new file mode 100644 index 0000000..150bf62 --- /dev/null +++ b/src/wrapper/signature_wrapper.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include + +#include "../wrapper/wrapper_base.hpp" + +class repository_wrapper; + +class signature_wrapper : public wrapper_base +{ +public: + using author_committer_signatures = std::pair; + + ~signature_wrapper(); + + signature_wrapper(signature_wrapper&&) = default; + signature_wrapper& operator=(signature_wrapper&&) = default; + + static author_committer_signatures get_default_signature_from_env(repository_wrapper&); + +private: + + signature_wrapper() = default; +}; diff --git a/test/data/status_data/embedded_git/HEAD b/test/data/status_data/embedded_git/HEAD index b870d82..990e32d 100644 --- a/test/data/status_data/embedded_git/HEAD +++ b/test/data/status_data/embedded_git/HEAD @@ -1 +1 @@ -ref: refs/heads/main +ref: refs/heads/commit_test_branch diff --git a/test/data/status_data/embedded_git/index b/test/data/status_data/embedded_git/index index 4c1df39..95e6675 100644 Binary files a/test/data/status_data/embedded_git/index and b/test/data/status_data/embedded_git/index differ diff --git a/test/data/status_data/embedded_git/logs/HEAD b/test/data/status_data/embedded_git/logs/HEAD index a996210..193713c 100644 --- a/test/data/status_data/embedded_git/logs/HEAD +++ b/test/data/status_data/embedded_git/logs/HEAD @@ -1,2 +1,18 @@ 0000000000000000000000000000000000000000 75743dcbd85064226c77a0b862af817838ae0b2e Sandrine Pataut 1750769952 +0200 commit (initial): first commit 75743dcbd85064226c77a0b862af817838ae0b2e ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1750771272 +0200 commit: Second commit +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887403 +0200 checkout: moving from main to bla +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887403 +0200 checkout: moving from bla to main +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887403 +0200 checkout: moving from main to bla +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887403 +0200 checkout: moving from bla to main +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887403 +0200 checkout: moving from main to bla +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887403 +0200 checkout: moving from bla to main +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887403 +0200 checkout: moving from main to bla +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887403 +0200 checkout: moving from bla to main +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887505 +0200 checkout: moving from main to commit_test_branch +ee8c4cf874c4f1e3ba755f929fe7811018adee3d cba545ef5cc4ddf12a9744b6a49b20dda1ef1d5c Sandrine Pataut 1753887505 +0200 commit: test commit +cba545ef5cc4ddf12a9744b6a49b20dda1ef1d5c ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887505 +0200 reset: moving to ee8c4cf874c4f1e3ba755f929fe7811018adee3d +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887505 +0200 checkout: moving from commit_test_branch to main +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753887505 +0200 checkout: moving from main to commit_test_branch +ee8c4cf874c4f1e3ba755f929fe7811018adee3d 75743dcbd85064226c77a0b862af817838ae0b2e Sandrine Pataut 1753888486 +0200 reset: moving to 75743dcbd85064226c77a0b862af817838ae0b2e +75743dcbd85064226c77a0b862af817838ae0b2e ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753888486 +0200 checkout: moving from commit_test_branch to main +ee8c4cf874c4f1e3ba755f929fe7811018adee3d ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753888486 +0200 checkout: moving from main to commit_test_branch diff --git a/test/data/status_data/embedded_git/logs/refs/heads/commit_test_branch b/test/data/status_data/embedded_git/logs/refs/heads/commit_test_branch new file mode 100644 index 0000000..0d35c1b --- /dev/null +++ b/test/data/status_data/embedded_git/logs/refs/heads/commit_test_branch @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 ee8c4cf874c4f1e3ba755f929fe7811018adee3d Sandrine Pataut 1753888486 +0200 branch: Created from ee8c4cf874c4f1e3ba755f929fe7811018adee3d diff --git a/test/data/status_data/embedded_git/objects/a3/079a98067bc027a22dc56fe619c5d30f23d3a6 b/test/data/status_data/embedded_git/objects/a3/079a98067bc027a22dc56fe619c5d30f23d3a6 new file mode 100644 index 0000000..50960b9 Binary files /dev/null and b/test/data/status_data/embedded_git/objects/a3/079a98067bc027a22dc56fe619c5d30f23d3a6 differ diff --git a/test/data/status_data/embedded_git/objects/cb/a545ef5cc4ddf12a9744b6a49b20dda1ef1d5c b/test/data/status_data/embedded_git/objects/cb/a545ef5cc4ddf12a9744b6a49b20dda1ef1d5c new file mode 100644 index 0000000..5aeeed1 Binary files /dev/null and b/test/data/status_data/embedded_git/objects/cb/a545ef5cc4ddf12a9744b6a49b20dda1ef1d5c differ diff --git a/test/data/status_data/embedded_git/refs/heads/commit_test_branch b/test/data/status_data/embedded_git/refs/heads/commit_test_branch new file mode 100644 index 0000000..6d6a647 --- /dev/null +++ b/test/data/status_data/embedded_git/refs/heads/commit_test_branch @@ -0,0 +1 @@ +ee8c4cf874c4f1e3ba755f929fe7811018adee3d diff --git a/test/data/status_data/other_test_file_new.txt b/test/data/status_data/other_test_file.txt similarity index 100% rename from test/data/status_data/other_test_file_new.txt rename to test/data/status_data/other_test_file.txt diff --git a/test/data/status_data/random_file.txt b/test/data/status_data/random_file.txt index c0fc9fb..dc430e3 100644 --- a/test/data/status_data/random_file.txt +++ b/test/data/status_data/random_file.txt @@ -1 +1 @@ -That's a random file modified. +That's a random file. diff --git a/test/data/status_data/test_file.txt b/test/data/status_data/test_file.txt new file mode 100644 index 0000000..bdef436 --- /dev/null +++ b/test/data/status_data/test_file.txt @@ -0,0 +1 @@ +This is the first test file. diff --git a/test/test_commit.py b/test/test_commit.py new file mode 100644 index 0000000..89381ac --- /dev/null +++ b/test/test_commit.py @@ -0,0 +1,40 @@ +import os +import subprocess + +import pytest + + +@pytest.mark.parametrize("all_flag", ["", "-A", "--all", "--no-ignore-removal"]) +def test_commit(rename_git, git2cpp_path, all_flag): + checkout_cmd = [git2cpp_path, 'checkout', '-b', 'commit_test_branch'] + subprocess.run(checkout_cmd, cwd="test/data/status_data", text=True) + + with open("./test/data/status_data/mook_file.txt", "x"): + pass + + cmd_add = [git2cpp_path, 'add', "mook_file.txt"] + subprocess.run(cmd_add, cwd="test/data/status_data", text=True) + + cmd_status = [git2cpp_path, 'status', "--long"] + p_status = subprocess.run(cmd_status, capture_output=True, cwd="test/data/status_data", text=True) + + assert "Changes to be committed" in p_status.stdout + assert "new file" in p_status.stdout + + cmd_commit = [git2cpp_path, 'commit', "-m", "test commit"] + subprocess.run(cmd_commit, cwd="test/data/status_data", text=True) + + cmd_status_2 = [git2cpp_path, 'status', "--long"] + p_status_2 = subprocess.run(cmd_status_2, capture_output=True, cwd="test/data/status_data", text=True) + + assert "mook_file" not in p_status_2.stdout + + cmd_reset = [git2cpp_path, 'reset', "--hard", "HEAD~1"] + subprocess.run(cmd_reset, cwd="test/data/status_data", text=True) + + checkout_cmd.remove('-b') + checkout_cmd[2] = 'main' + subprocess.run(checkout_cmd, cwd="test/data/status_data", text=True) + + del_cmd = [git2cpp_path, 'branch', '-d', 'commit_test_branch'] + subprocess.run(del_cmd, cwd="test/data/status_data", text=True)