Commit 72f8da91 by Edward Thomson

Merge pull request #3089 from volftomas/patch-2

Added call to git_libgit2_shutdown()
parents ef23a82f 785990be
...@@ -23,8 +23,8 @@ static int run_command(git_cb fn, int argc, char **argv) ...@@ -23,8 +23,8 @@ static int run_command(git_cb fn, int argc, char **argv)
int error; int error;
git_repository *repo; git_repository *repo;
// Before running the actual command, create an instance of the local // Before running the actual command, create an instance of the local
// repository and pass it to the function. // repository and pass it to the function.
error = git_repository_open(&repo, ".git"); error = git_repository_open(&repo, ".git");
if (error < 0) if (error < 0)
...@@ -48,6 +48,7 @@ static int run_command(git_cb fn, int argc, char **argv) ...@@ -48,6 +48,7 @@ static int run_command(git_cb fn, int argc, char **argv)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int i; int i;
int return_code = 1;
if (argc < 2) { if (argc < 2) {
fprintf(stderr, "usage: %s <cmd> [repo]\n", argv[0]); fprintf(stderr, "usage: %s <cmd> [repo]\n", argv[0]);
...@@ -57,10 +58,16 @@ int main(int argc, char **argv) ...@@ -57,10 +58,16 @@ int main(int argc, char **argv)
git_libgit2_init(); git_libgit2_init();
for (i = 0; commands[i].name != NULL; ++i) { for (i = 0; commands[i].name != NULL; ++i) {
if (!strcmp(argv[1], commands[i].name)) if (!strcmp(argv[1], commands[i].name)) {
return run_command(commands[i].fn, --argc, ++argv); return_code = run_command(commands[i].fn, --argc, ++argv);
goto shutdown;
}
} }
fprintf(stderr, "Command not found: %s\n", argv[1]); fprintf(stderr, "Command not found: %s\n", argv[1]);
return 1;
shutdown:
git_libgit2_shutdown();
return return_code;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment