summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-01-12 22:01:45 +0100
committerPatrick Steinhardt <ps@pks.im>2017-01-12 22:01:45 +0100
commited2b1c7e75ab9d8aa4b23eec81bb023bcfdabbda (patch)
tree9e97fc7d16999883a1a86f9a147906772aebe553
parent5aa101078eec51a99fbbf4015162da7e254bb320 (diff)
downloadlibgit2-ed2b1c7e75ab9d8aa4b23eec81bb023bcfdabbda.tar.gz
examples: general: display config only if it was found
-rw-r--r--examples/general.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/general.c b/examples/general.c
index aa54074a7..ecb7c212f 100644
--- a/examples/general.c
+++ b/examples/general.c
@@ -698,7 +698,7 @@ static void config_files(const char *repo_path, git_repository* repo)
{
const char *email;
char config_path[256];
- int32_t j;
+ int32_t autocorrect;
git_config *cfg;
git_config *snap_cfg;
@@ -710,8 +710,8 @@ static void config_files(const char *repo_path, git_repository* repo)
sprintf(config_path, "%s/config", repo_path);
check_error(git_config_open_ondisk(&cfg, config_path), "opening config");
- git_config_get_int32(&j, cfg, "help.autocorrect");
- printf("Autocorrect: %d\n", j);
+ if (git_config_get_int32(&autocorrect, cfg, "help.autocorrect") == 0)
+ printf("Autocorrect: %d\n", autocorrect);
check_error(git_repository_config_snapshot(&snap_cfg, repo), "config snapshot");
git_config_get_string(&email, snap_cfg, "user.email");