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
4f664a1b
Commit
4f664a1b
authored
May 19, 2011
by
Jakob Pfender
Committed by
Vicent Marti
May 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repository.c: Move to new error handling mechanism
parent
0d5d5190
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
src/repository.c
+11
-11
No files found.
src/repository.c
View file @
4f664a1b
...
@@ -63,11 +63,11 @@ static int assign_repository_dirs(
...
@@ -63,11 +63,11 @@ static int assign_repository_dirs(
assert
(
repo
);
assert
(
repo
);
if
(
git_dir
==
NULL
)
if
(
git_dir
==
NULL
)
return
GIT_ENOTFOUND
;
return
git__throw
(
GIT_ENOTFOUND
,
"Failed to open repository. Git dir not found"
)
;
error
=
gitfo_prettify_dir_path
(
path_aux
,
sizeof
(
path_aux
),
git_dir
);
error
=
gitfo_prettify_dir_path
(
path_aux
,
sizeof
(
path_aux
),
git_dir
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to open repository"
)
;
/* store GIT_DIR */
/* store GIT_DIR */
repo
->
path_repository
=
git__strdup
(
path_aux
);
repo
->
path_repository
=
git__strdup
(
path_aux
);
...
@@ -80,7 +80,7 @@ static int assign_repository_dirs(
...
@@ -80,7 +80,7 @@ static int assign_repository_dirs(
else
{
else
{
error
=
gitfo_prettify_dir_path
(
path_aux
,
sizeof
(
path_aux
),
git_object_directory
);
error
=
gitfo_prettify_dir_path
(
path_aux
,
sizeof
(
path_aux
),
git_object_directory
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to open repository"
)
;
}
}
/* Store GIT_OBJECT_DIRECTORY */
/* Store GIT_OBJECT_DIRECTORY */
...
@@ -94,7 +94,7 @@ static int assign_repository_dirs(
...
@@ -94,7 +94,7 @@ static int assign_repository_dirs(
else
{
else
{
error
=
gitfo_prettify_dir_path
(
path_aux
,
sizeof
(
path_aux
),
git_work_tree
);
error
=
gitfo_prettify_dir_path
(
path_aux
,
sizeof
(
path_aux
),
git_work_tree
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to open repository"
)
;
/* Store GIT_WORK_TREE */
/* Store GIT_WORK_TREE */
repo
->
path_workdir
=
git__strdup
(
path_aux
);
repo
->
path_workdir
=
git__strdup
(
path_aux
);
...
@@ -107,7 +107,7 @@ static int assign_repository_dirs(
...
@@ -107,7 +107,7 @@ static int assign_repository_dirs(
else
{
else
{
error
=
gitfo_prettify_file_path
(
path_aux
,
sizeof
(
path_aux
),
git_index_file
);
error
=
gitfo_prettify_file_path
(
path_aux
,
sizeof
(
path_aux
),
git_index_file
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to open repository"
)
;
}
}
/* store GIT_INDEX_FILE */
/* store GIT_INDEX_FILE */
...
@@ -332,7 +332,7 @@ int git_repository_index(git_index **index_out, git_repository *repo)
...
@@ -332,7 +332,7 @@ int git_repository_index(git_index **index_out, git_repository *repo)
if
(
repo
->
index
==
NULL
)
{
if
(
repo
->
index
==
NULL
)
{
error
=
git_index_open_inrepo
(
&
repo
->
index
,
repo
);
/* TODO: move index.c to new error handling */
error
=
git_index_open_inrepo
(
&
repo
->
index
,
repo
);
/* TODO: move index.c to new error handling */
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to open repository index"
)
;
assert
(
repo
->
index
!=
NULL
);
assert
(
repo
->
index
!=
NULL
);
}
}
...
@@ -351,7 +351,7 @@ static int repo_init_reinit(repo_init *results)
...
@@ -351,7 +351,7 @@ static int repo_init_reinit(repo_init *results)
{
{
/* TODO: reinit the repository */
/* TODO: reinit the repository */
results
->
has_been_reinit
=
1
;
results
->
has_been_reinit
=
1
;
return
GIT_ENOTIMPLEMENTED
;
return
git__throw
(
GIT_ENOTIMPLEMENTED
,
"Failed to reinitialize the repository. This feature is not yet implemented"
)
;
}
}
static
int
repo_init_createhead
(
git_repository
*
repo
)
static
int
repo_init_createhead
(
git_repository
*
repo
)
...
@@ -377,13 +377,13 @@ static int repo_init_structure(repo_init *results)
...
@@ -377,13 +377,13 @@ static int repo_init_structure(repo_init *results)
char
*
git_dir
=
results
->
path_repository
;
char
*
git_dir
=
results
->
path_repository
;
if
(
gitfo_mkdir_recurs
(
git_dir
,
mode
))
if
(
gitfo_mkdir_recurs
(
git_dir
,
mode
))
return
GIT_ERROR
;
return
git__throw
(
GIT_ERROR
,
"Failed to initialize repository structure. Could not mkdir"
)
;
/* Creates the '/objects/info/' directory */
/* Creates the '/objects/info/' directory */
git__joinpath
(
temp_path
,
git_dir
,
GIT_OBJECTS_INFO_DIR
);
git__joinpath
(
temp_path
,
git_dir
,
GIT_OBJECTS_INFO_DIR
);
error
=
gitfo_mkdir_recurs
(
temp_path
,
mode
);
error
=
gitfo_mkdir_recurs
(
temp_path
,
mode
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to initialize repository structure"
)
;
/* Creates the '/objects/pack/' directory */
/* Creates the '/objects/pack/' directory */
git__joinpath
(
temp_path
,
git_dir
,
GIT_OBJECTS_PACK_DIR
);
git__joinpath
(
temp_path
,
git_dir
,
GIT_OBJECTS_PACK_DIR
);
...
@@ -395,7 +395,7 @@ static int repo_init_structure(repo_init *results)
...
@@ -395,7 +395,7 @@ static int repo_init_structure(repo_init *results)
git__joinpath
(
temp_path
,
git_dir
,
GIT_REFS_HEADS_DIR
);
git__joinpath
(
temp_path
,
git_dir
,
GIT_REFS_HEADS_DIR
);
error
=
gitfo_mkdir_recurs
(
temp_path
,
mode
);
error
=
gitfo_mkdir_recurs
(
temp_path
,
mode
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to initialize repository structure"
)
;
/* Creates the '/refs/tags/' directory */
/* Creates the '/refs/tags/' directory */
git__joinpath
(
temp_path
,
git_dir
,
GIT_REFS_TAGS_DIR
);
git__joinpath
(
temp_path
,
git_dir
,
GIT_REFS_TAGS_DIR
);
...
@@ -415,7 +415,7 @@ static int repo_init_find_dir(repo_init *results, const char* path)
...
@@ -415,7 +415,7 @@ static int repo_init_find_dir(repo_init *results, const char* path)
error
=
gitfo_prettify_dir_path
(
temp_path
,
sizeof
(
temp_path
),
path
);
error
=
gitfo_prettify_dir_path
(
temp_path
,
sizeof
(
temp_path
),
path
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
error
;
return
git__rethrow
(
error
,
"Failed to find directory to initialize repository"
)
;
if
(
!
results
->
is_bare
)
{
if
(
!
results
->
is_bare
)
{
git__joinpath
(
temp_path
,
temp_path
,
GIT_DIR
);
git__joinpath
(
temp_path
,
temp_path
,
GIT_DIR
);
...
...
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