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
54be4d57
Commit
54be4d57
authored
Nov 20, 2012
by
Russell Belfer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1092 from arrbee/legal-to-not-have-gitconfig
It is okay to not have a .gitconfig file
parents
f0ebf82e
38f7d026
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
19 deletions
+28
-19
src/config.c
+1
-1
src/repository.c
+27
-18
No files found.
src/config.c
View file @
54be4d57
...
@@ -93,7 +93,7 @@ int git_config_add_file_ondisk(
...
@@ -93,7 +93,7 @@ int git_config_add_file_ondisk(
assert
(
cfg
&&
path
);
assert
(
cfg
&&
path
);
if
(
!
git_path_isfile
(
path
))
{
if
(
!
git_path_isfile
(
path
))
{
giterr_set
(
GITERR_CONFIG
,
"
File '%s' doesn't exists.
"
,
path
);
giterr_set
(
GITERR_CONFIG
,
"
Cannot find config file '%s'
"
,
path
);
return
GIT_ENOTFOUND
;
return
GIT_ENOTFOUND
;
}
}
...
...
src/repository.c
View file @
54be4d57
...
@@ -450,37 +450,46 @@ static int load_config(
...
@@ -450,37 +450,46 @@ static int load_config(
const
char
*
xdg_config_path
,
const
char
*
xdg_config_path
,
const
char
*
system_config_path
)
const
char
*
system_config_path
)
{
{
int
error
;
git_buf
config_path
=
GIT_BUF_INIT
;
git_buf
config_path
=
GIT_BUF_INIT
;
git_config
*
cfg
=
NULL
;
git_config
*
cfg
=
NULL
;
assert
(
repo
&&
out
);
assert
(
repo
&&
out
);
if
(
git_config_new
(
&
cfg
)
<
0
)
if
(
(
error
=
git_config_new
(
&
cfg
)
)
<
0
)
return
-
1
;
return
error
;
if
(
git_buf_joinpath
(
error
=
git_buf_joinpath
(
&
config_path
,
repo
->
path_repository
,
GIT_CONFIG_FILENAME_INREPO
)
<
0
)
&
config_path
,
repo
->
path_repository
,
GIT_CONFIG_FILENAME_INREPO
);
if
(
error
<
0
)
goto
on_error
;
goto
on_error
;
if
(
git_config_add_file_ondisk
(
cfg
,
config_path
.
ptr
,
GIT_CONFIG_LEVEL_LOCAL
,
0
)
<
0
)
if
((
error
=
git_config_add_file_ondisk
(
cfg
,
config_path
.
ptr
,
GIT_CONFIG_LEVEL_LOCAL
,
0
))
<
0
&&
error
!=
GIT_ENOTFOUND
)
goto
on_error
;
goto
on_error
;
git_buf_free
(
&
config_path
);
git_buf_free
(
&
config_path
);
if
(
global_config_path
!=
NULL
)
{
if
(
global_config_path
!=
NULL
&&
if
(
git_config_add_file_ondisk
(
cfg
,
global_config_path
,
GIT_CONFIG_LEVEL_GLOBAL
,
0
)
<
0
)
(
error
=
git_config_add_file_ondisk
(
goto
on_error
;
cfg
,
global_config_path
,
GIT_CONFIG_LEVEL_GLOBAL
,
0
))
<
0
&&
}
error
!=
GIT_ENOTFOUND
)
goto
on_error
;
if
(
xdg_config_path
!=
NULL
)
{
if
(
xdg_config_path
!=
NULL
&&
if
(
git_config_add_file_ondisk
(
cfg
,
xdg_config_path
,
GIT_CONFIG_LEVEL_XDG
,
0
)
<
0
)
(
error
=
git_config_add_file_ondisk
(
goto
on_error
;
cfg
,
xdg_config_path
,
GIT_CONFIG_LEVEL_XDG
,
0
))
<
0
&&
}
error
!=
GIT_ENOTFOUND
)
goto
on_error
;
if
(
system_config_path
!=
NULL
)
{
if
(
system_config_path
!=
NULL
&&
if
(
git_config_add_file_ondisk
(
cfg
,
system_config_path
,
GIT_CONFIG_LEVEL_SYSTEM
,
0
)
<
0
)
(
error
=
git_config_add_file_ondisk
(
goto
on_error
;
cfg
,
system_config_path
,
GIT_CONFIG_LEVEL_SYSTEM
,
0
))
<
0
&&
}
error
!=
GIT_ENOTFOUND
)
goto
on_error
;
giterr_clear
();
/* clear any lingering ENOTFOUND errors */
*
out
=
cfg
;
*
out
=
cfg
;
return
0
;
return
0
;
...
@@ -489,7 +498,7 @@ on_error:
...
@@ -489,7 +498,7 @@ on_error:
git_buf_free
(
&
config_path
);
git_buf_free
(
&
config_path
);
git_config_free
(
cfg
);
git_config_free
(
cfg
);
*
out
=
NULL
;
*
out
=
NULL
;
return
-
1
;
return
error
;
}
}
int
git_repository_config__weakptr
(
git_config
**
out
,
git_repository
*
repo
)
int
git_repository_config__weakptr
(
git_config
**
out
,
git_repository
*
repo
)
...
...
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