Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
832278bf
Commit
832278bf
authored
Dec 29, 2016
by
Douglas Swanson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue #4046 Seg fault in config_files()
parent
238b8ccd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
examples/general.c
+6
-4
No files found.
examples/general.c
View file @
832278bf
...
...
@@ -57,7 +57,7 @@ static void blob_parsing(git_repository *repo);
static
void
revwalking
(
git_repository
*
repo
);
static
void
index_walking
(
git_repository
*
repo
);
static
void
reference_listing
(
git_repository
*
repo
);
static
void
config_files
(
const
char
*
repo_path
);
static
void
config_files
(
const
char
*
repo_path
,
git_repository
*
repo
);
/**
* Almost all libgit2 functions return 0 on success or negative on error.
...
...
@@ -115,7 +115,7 @@ int main (int argc, char** argv)
revwalking
(
repo
);
index_walking
(
repo
);
reference_listing
(
repo
);
config_files
(
repo_path
);
config_files
(
repo_path
,
repo
);
/**
* Finally, when you're done with the repository, you can free it as well.
...
...
@@ -692,12 +692,13 @@ static void reference_listing(git_repository *repo)
*
* [config]: http://libgit2.github.com/libgit2/#HEAD/group/config
*/
static
void
config_files
(
const
char
*
repo_path
)
static
void
config_files
(
const
char
*
repo_path
,
git_repository
*
repo
)
{
const
char
*
email
;
char
config_path
[
256
];
int32_t
j
;
git_config
*
cfg
;
git_config
*
snap_cfg
;
printf
(
"
\n
*Config Listing*
\n
"
);
...
...
@@ -710,6 +711,7 @@ static void config_files(const char *repo_path)
git_config_get_int32
(
&
j
,
cfg
,
"help.autocorrect"
);
printf
(
"Autocorrect: %d
\n
"
,
j
);
git_config_get_string
(
&
email
,
cfg
,
"user.email"
);
check_error
(
git_repository_config_snapshot
(
&
snap_cfg
,
repo
),
"config snapshot"
);
git_config_get_string
(
&
email
,
snap_cfg
,
"user.email"
);
printf
(
"Email: %s
\n
"
,
email
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment