Skip to content

Commit 71a5155

Browse files
author
Ren Peng
committed
update
1 parent 72f30dc commit 71a5155

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/cgit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ namespace cgit {
3030
return ss.str();
3131
}
3232

33-
string get_git_file() {
33+
string get_git_file(bool q) {
3434
auto git = get_env("GIT", DEFAULT_GIT_FILE);
3535
if (git == nullptr) {
3636
printf("please set the environment variable `GIT`.");
3737
exit(-1);
3838
}
3939

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

4343
return git_str;
4444
}

src/cgit.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "string.hpp"
88

99
namespace cgit {
10-
string get_git_file();
10+
string get_git_file(bool q = true);
1111

1212
int cgit_clone(std::vector<string> &argv);
1313
}

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ int main(int argc, char **argv) {
1313
}
1414

1515
if (argc > 2 && args[1] == "clone") return cgit_clone(args);
16-
else return execv(get_git_file(), argv);
16+
else return exec(get_git_file(false), argv);
1717
}

src/utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace cgit {
1919
return err == 0 && file != nullptr ? file : default_value;
2020
}
2121

22-
int execv(const string &file_name, char const *const *arguments) {
22+
int exec(const string &file_name, char *const *arguments) {
2323
return _execv(file_name.c_str(), arguments);
2424
}
2525

@@ -32,7 +32,7 @@ namespace cgit {
3232
return file ? file : default_value;
3333
}
3434

35-
int execv(const string &file_name, char const* const* arguments){
35+
int exec(const string &file_name, char *const* arguments){
3636
return execv(file_name.c_str(), arguments);
3737
}
3838

src/utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace cgit {
55
const char *get_env(const char *name, const char *default_value);
66

7-
int execv(const string &file_name, char const *const *arguments);
7+
int exec(const string &file_name, char *const *arguments);
88

99
int cd(const string &path);
1010
}

0 commit comments

Comments
 (0)