From 71a51559ec91c0d8bf696406212bdf3129c841db Mon Sep 17 00:00:00 2001 From: Ren Peng Date: Fri, 27 Aug 2021 19:18:28 +0800 Subject: [PATCH] update --- src/cgit.cpp | 4 ++-- src/cgit.hpp | 2 +- src/main.cpp | 2 +- src/utils.cpp | 4 ++-- src/utils.hpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cgit.cpp b/src/cgit.cpp index c0871dd..e3d6aaa 100644 --- a/src/cgit.cpp +++ b/src/cgit.cpp @@ -30,7 +30,7 @@ namespace cgit { return ss.str(); } - string get_git_file() { + string get_git_file(bool q) { auto git = get_env("GIT", DEFAULT_GIT_FILE); if (git == nullptr) { printf("please set the environment variable `GIT`."); @@ -38,7 +38,7 @@ namespace cgit { } string git_str(git); - if (git_str[0] != '"') git_str = '"' + git_str + '"'; + if (q && git_str[0] != '"') git_str = '"' + git_str + '"'; return git_str; } diff --git a/src/cgit.hpp b/src/cgit.hpp index 57d5378..b7c3043 100644 --- a/src/cgit.hpp +++ b/src/cgit.hpp @@ -7,7 +7,7 @@ #include "string.hpp" namespace cgit { - string get_git_file(); + string get_git_file(bool q = true); int cgit_clone(std::vector &argv); } diff --git a/src/main.cpp b/src/main.cpp index e7de325..d5e7f98 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,5 +13,5 @@ int main(int argc, char **argv) { } if (argc > 2 && args[1] == "clone") return cgit_clone(args); - else return execv(get_git_file(), argv); + else return exec(get_git_file(false), argv); } diff --git a/src/utils.cpp b/src/utils.cpp index 372ab87..2613d98 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -19,7 +19,7 @@ namespace cgit { return err == 0 && file != nullptr ? file : default_value; } - int execv(const string &file_name, char const *const *arguments) { + int exec(const string &file_name, char *const *arguments) { return _execv(file_name.c_str(), arguments); } @@ -32,7 +32,7 @@ namespace cgit { return file ? file : default_value; } - int execv(const string &file_name, char const* const* arguments){ + int exec(const string &file_name, char *const* arguments){ return execv(file_name.c_str(), arguments); } diff --git a/src/utils.hpp b/src/utils.hpp index 820e385..492ff7a 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -4,7 +4,7 @@ namespace cgit { const char *get_env(const char *name, const char *default_value); - int execv(const string &file_name, char const *const *arguments); + int exec(const string &file_name, char *const *arguments); int cd(const string &path); }