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
f95e8cc0
Commit
f95e8cc0
authored
May 05, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notes: Cleanup error handling
parent
d3a60dc2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
19 deletions
+11
-19
src/notes.c
+11
-19
No files found.
src/notes.c
View file @
f95e8cc0
...
...
@@ -265,7 +265,7 @@ static int note_remove(git_repository *repo,
static
int
note_get_default_ref
(
const
char
**
out
,
git_repository
*
repo
)
{
int
error
;
int
ret
;
git_config
*
cfg
;
*
out
=
NULL
;
...
...
@@ -273,13 +273,13 @@ static int note_get_default_ref(const char **out, git_repository *repo)
if
(
git_repository_config__weakptr
(
&
cfg
,
repo
)
<
0
)
return
-
1
;
error
=
git_config_get_string
(
cfg
,
"core.notesRef"
,
out
);
if
(
error
==
GIT_ENOTFOUND
)
{
ret
=
git_config_get_string
(
cfg
,
"core.notesRef"
,
out
);
if
(
ret
==
GIT_ENOTFOUND
)
{
*
out
=
GIT_NOTES_DEFAULT_REF
;
return
0
;
}
return
error
;
return
ret
;
}
int
git_note_read
(
git_note
**
out
,
git_repository
*
repo
,
...
...
@@ -293,11 +293,8 @@ int git_note_read(git_note **out, git_repository *repo,
*
out
=
NULL
;
if
(
!
notes_ref
)
{
error
=
note_get_default_ref
(
&
notes_ref
,
repo
);
if
(
error
<
0
)
return
error
;
}
if
(
!
notes_ref
&&
note_get_default_ref
(
&
notes_ref
,
repo
)
<
0
)
return
-
1
;
error
=
git_reference_lookup
(
&
ref
,
repo
,
notes_ref
);
if
(
error
<
0
)
...
...
@@ -337,11 +334,8 @@ int git_note_create(
git_commit
*
commit
=
NULL
;
git_reference
*
ref
;
if
(
!
notes_ref
)
{
error
=
note_get_default_ref
(
&
notes_ref
,
repo
);
if
(
error
<
0
)
return
error
;
}
if
(
!
notes_ref
&&
note_get_default_ref
(
&
notes_ref
,
repo
)
<
0
)
return
-
1
;
error
=
git_reference_lookup
(
&
ref
,
repo
,
notes_ref
);
if
(
error
<
0
&&
error
!=
GIT_ENOTFOUND
)
...
...
@@ -385,11 +379,9 @@ int git_note_remove(git_repository *repo, const char *notes_ref,
git_commit
*
commit
;
git_reference
*
ref
;
if
(
!
notes_ref
)
{
error
=
note_get_default_ref
(
&
notes_ref
,
repo
);
if
(
error
<
0
)
return
error
;
}
if
(
!
notes_ref
&&
note_get_default_ref
(
&
notes_ref
,
repo
)
<
0
)
return
-
1
;
error
=
git_reference_lookup
(
&
ref
,
repo
,
notes_ref
);
if
(
error
<
0
)
...
...
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