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
e54d8d89
Commit
e54d8d89
authored
Mar 07, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error-handling: Config
parent
cb8a7961
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
98 deletions
+112
-98
include/git2/errors.h
+1
-0
src/config.c
+103
-91
src/fileops.c
+8
-7
No files found.
include/git2/errors.h
View file @
e54d8d89
...
@@ -126,6 +126,7 @@ typedef enum {
...
@@ -126,6 +126,7 @@ typedef enum {
GITERR_REFERENCE
,
GITERR_REFERENCE
,
GITERR_ZLIB
,
GITERR_ZLIB
,
GITERR_REPOSITORY
,
GITERR_REPOSITORY
,
GITERR_CONFIG
,
}
git_error_class
;
}
git_error_class
;
#define GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
#define GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
...
...
src/config.c
View file @
e54d8d89
This diff is collapsed.
Click to expand it.
src/fileops.c
View file @
e54d8d89
...
@@ -295,7 +295,6 @@ int git_futils_rmdir_r(const char *path, int force)
...
@@ -295,7 +295,6 @@ int git_futils_rmdir_r(const char *path, int force)
int
git_futils_find_global_file
(
git_buf
*
path
,
const
char
*
filename
)
int
git_futils_find_global_file
(
git_buf
*
path
,
const
char
*
filename
)
{
{
int
error
;
const
char
*
home
=
getenv
(
"HOME"
);
const
char
*
home
=
getenv
(
"HOME"
);
#ifdef GIT_WIN32
#ifdef GIT_WIN32
...
@@ -303,19 +302,21 @@ int git_futils_find_global_file(git_buf *path, const char *filename)
...
@@ -303,19 +302,21 @@ int git_futils_find_global_file(git_buf *path, const char *filename)
home
=
getenv
(
"USERPROFILE"
);
home
=
getenv
(
"USERPROFILE"
);
#endif
#endif
if
(
home
==
NULL
)
if
(
home
==
NULL
)
{
return
git__throw
(
GIT_EOSERR
,
"Failed to open global %s file. "
giterr_set
(
GITERR_OS
,
"Global file lookup failed. "
"Cannot locate the user's home directory."
,
filename
);
"Cannot locate the user's home directory"
);
return
-
1
;
}
if
(
(
error
=
git_buf_joinpath
(
path
,
home
,
filename
))
<
GIT_SUCCESS
)
if
(
git_buf_joinpath
(
path
,
home
,
filename
)
<
0
)
return
error
;
return
-
1
;
if
(
git_path_exists
(
path
->
ptr
)
==
false
)
{
if
(
git_path_exists
(
path
->
ptr
)
==
false
)
{
git_buf_clear
(
path
);
git_buf_clear
(
path
);
return
GIT_ENOTFOUND
;
return
GIT_ENOTFOUND
;
}
}
return
GIT_SUCCESS
;
return
0
;
}
}
#ifdef GIT_WIN32
#ifdef GIT_WIN32
...
...
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