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
dbe70bd5
Commit
dbe70bd5
authored
Jun 18, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: Fix compilation in MSVC
parent
40070445
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
13 deletions
+6
-13
src/config.c
+5
-5
tests/t15-config.c
+1
-8
No files found.
src/config.c
View file @
dbe70bd5
...
@@ -303,7 +303,8 @@ int git_config_get_string(git_config *cfg, const char *name, const char **out)
...
@@ -303,7 +303,8 @@ int git_config_get_string(git_config *cfg, const char *name, const char **out)
{
{
file_internal
*
internal
;
file_internal
*
internal
;
git_config_file
*
file
;
git_config_file
*
file
;
int
i
,
error
;
int
error
=
GIT_ENOTFOUND
;
unsigned
int
i
;
if
(
cfg
->
files
.
length
==
0
)
if
(
cfg
->
files
.
length
==
0
)
return
git__throw
(
GIT_EINVALIDARGS
,
"Cannot get variable value; no files open in the `git_config` instance"
);
return
git__throw
(
GIT_EINVALIDARGS
,
"Cannot get variable value; no files open in the `git_config` instance"
);
...
@@ -311,11 +312,10 @@ int git_config_get_string(git_config *cfg, const char *name, const char **out)
...
@@ -311,11 +312,10 @@ int git_config_get_string(git_config *cfg, const char *name, const char **out)
for
(
i
=
0
;
i
<
cfg
->
files
.
length
;
++
i
)
{
for
(
i
=
0
;
i
<
cfg
->
files
.
length
;
++
i
)
{
internal
=
git_vector_get
(
&
cfg
->
files
,
i
);
internal
=
git_vector_get
(
&
cfg
->
files
,
i
);
file
=
internal
->
file
;
file
=
internal
->
file
;
error
=
file
->
get
(
file
,
name
,
out
);
if
((
error
=
file
->
get
(
file
,
name
,
out
))
==
GIT_SUCCESS
)
if
(
error
==
GIT_SUCCESS
)
return
GIT_SUCCESS
;
break
;
}
}
return
error
;
return
git__throw
(
error
,
"Config value '%s' not found"
,
name
)
;
}
}
tests/t15-config.c
View file @
dbe70bd5
...
@@ -212,18 +212,11 @@ END_TEST
...
@@ -212,18 +212,11 @@ END_TEST
BEGIN_TEST
(
config10
,
"a repo's config overrides the global config"
)
BEGIN_TEST
(
config10
,
"a repo's config overrides the global config"
)
git_repository
*
repo
;
git_repository
*
repo
;
char
home_orig
[
GIT_PATH_MAX
];
char
*
home
;
git_config
*
cfg
;
git_config
*
cfg
;
int
version
;
int
version
;
home
=
getenv
(
"HOME"
);
strcpy
(
home_orig
,
home
);
setenv
(
"HOME"
,
CONFIG_BASE
,
1
);
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_repository_config
(
&
cfg
,
repo
,
NULL
,
NULL
));
must_pass
(
git_repository_config
(
&
cfg
,
repo
,
CONFIG_BASE
"/.gitconfig"
,
NULL
));
setenv
(
"HOME"
,
home_orig
,
1
);
must_pass
(
git_config_get_int
(
cfg
,
"core.repositoryformatversion"
,
&
version
));
must_pass
(
git_config_get_int
(
cfg
,
"core.repositoryformatversion"
,
&
version
));
must_be_true
(
version
==
0
);
must_be_true
(
version
==
0
);
git_config_free
(
cfg
);
git_config_free
(
cfg
);
...
...
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