Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ren Peng committed Aug 27, 2021
1 parent 72f30dc commit 71a5155
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cgit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ 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`.");
exit(-1);
}

string git_str(git);
if (git_str[0] != '"') git_str = '"' + git_str + '"';
if (q && git_str[0] != '"') git_str = '"' + git_str + '"';

return git_str;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cgit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> &argv);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 71a5155

Please sign in to comment.