Commit ed2b1c7e by Patrick Steinhardt

examples: general: display config only if it was found

parent 5aa10107
...@@ -698,7 +698,7 @@ static void config_files(const char *repo_path, git_repository* repo) ...@@ -698,7 +698,7 @@ static void config_files(const char *repo_path, git_repository* repo)
{ {
const char *email; const char *email;
char config_path[256]; char config_path[256];
int32_t j; int32_t autocorrect;
git_config *cfg; git_config *cfg;
git_config *snap_cfg; git_config *snap_cfg;
...@@ -710,8 +710,8 @@ static void config_files(const char *repo_path, git_repository* repo) ...@@ -710,8 +710,8 @@ static void config_files(const char *repo_path, git_repository* repo)
sprintf(config_path, "%s/config", repo_path); sprintf(config_path, "%s/config", repo_path);
check_error(git_config_open_ondisk(&cfg, config_path), "opening config"); check_error(git_config_open_ondisk(&cfg, config_path), "opening config");
git_config_get_int32(&j, cfg, "help.autocorrect"); if (git_config_get_int32(&autocorrect, cfg, "help.autocorrect") == 0)
printf("Autocorrect: %d\n", j); printf("Autocorrect: %d\n", autocorrect);
check_error(git_repository_config_snapshot(&snap_cfg, repo), "config snapshot"); check_error(git_repository_config_snapshot(&snap_cfg, repo), "config snapshot");
git_config_get_string(&email, snap_cfg, "user.email"); git_config_get_string(&email, snap_cfg, "user.email");
......
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