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
26c1cb91
Commit
26c1cb91
authored
Dec 09, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
One more rename/cleanup for callback err functions
parent
f10d7a36
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
71 additions
and
49 deletions
+71
-49
src/attr.c
+1
-1
src/checkout.c
+7
-4
src/common.h
+6
-3
src/config.c
+3
-3
src/diff.c
+6
-2
src/diff_patch.c
+1
-1
src/diff_print.c
+2
-2
src/fetchhead.c
+1
-1
src/index.c
+14
-6
src/indexer.c
+1
-1
src/merge.c
+1
-1
src/notes.c
+1
-1
src/odb_loose.c
+1
-1
src/pack-objects.c
+1
-1
src/pack.c
+2
-4
src/path.c
+2
-2
src/push.c
+1
-1
src/refs.c
+3
-3
src/remote.c
+1
-1
src/stash.c
+1
-1
src/status.c
+1
-1
src/submodule.c
+1
-1
src/tag.c
+2
-2
src/tree.c
+11
-5
No files found.
src/attr.c
View file @
26c1cb91
...
...
@@ -193,7 +193,7 @@ int git_attr_foreach(
error
=
callback
(
assign
->
name
,
assign
->
value
,
payload
);
if
(
error
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
goto
cleanup
;
}
}
...
...
src/checkout.c
View file @
26c1cb91
...
...
@@ -123,10 +123,13 @@ static int checkout_notify(
path
=
delta
->
old_file
.
path
;
}
return
giterr_set_callback
(
data
->
opts
.
notify_cb
(
why
,
path
,
baseline
,
target
,
workdir
,
data
->
opts
.
notify_payload
),
"git_checkout notification"
);
{
int
error
=
data
->
opts
.
notify_cb
(
why
,
path
,
baseline
,
target
,
workdir
,
data
->
opts
.
notify_payload
);
return
giterr_set_after_callback_function
(
error
,
"git_checkout notification"
);
}
}
static
bool
checkout_is_workdir_modified
(
...
...
src/common.h
View file @
26c1cb91
...
...
@@ -83,7 +83,8 @@ int giterr_set_regex(const regex_t *regex, int error_code);
*
* @return This always returns the `error_code` parameter.
*/
GIT_INLINE
(
int
)
giterr_set_callback
(
int
error_code
,
const
char
*
action
)
GIT_INLINE
(
int
)
giterr_set_after_callback_function
(
int
error_code
,
const
char
*
action
)
{
if
(
error_code
)
{
const
git_error
*
e
=
giterr_last
();
...
...
@@ -95,9 +96,11 @@ GIT_INLINE(int) giterr_set_callback(int error_code, const char *action)
}
#ifdef GIT_WIN32
#define GITERR_CALLBACK(code) giterr_set_callback((code), __FUNCTION__)
#define giterr_set_after_callback(code) \
giterr_set_after_callback_function((code), __FUNCTION__)
#else
#define GITERR_CALLBACK(code) giterr_set_callback((code), __func__)
#define giterr_set_after_callback(code) \
giterr_set_after_callback_function((code), __func__)
#endif
/**
...
...
src/config.c
View file @
26c1cb91
...
...
@@ -508,7 +508,7 @@ int git_config_backend_foreach_match(
/* abort iterator on non-zero return value */
if
((
error
=
cb
(
entry
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
@@ -536,7 +536,7 @@ int git_config_foreach_match(
while
(
!
(
error
=
git_config_next
(
&
entry
,
iter
)))
{
if
((
error
=
cb
(
entry
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
@@ -799,7 +799,7 @@ int git_config_get_multivar_foreach(
found
=
1
;
if
((
err
=
cb
(
entry
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
err
);
giterr_set_after_callback
(
err
);
break
;
}
}
...
...
src/diff.c
View file @
26c1cb91
...
...
@@ -60,7 +60,11 @@ static int diff_insert_delta(
if
(
error
)
{
git__free
(
delta
);
return
(
error
>
0
)
?
0
:
giterr_set_callback
(
error
,
"git_diff"
);
if
(
error
>
0
)
/* positive value means to skip this delta */
return
0
;
else
/* negative value means to cancel diff */
return
giterr_set_after_callback_function
(
error
,
"git_diff"
);
}
}
...
...
@@ -1389,7 +1393,7 @@ int git_diff__paired_foreach(
}
if
((
error
=
cb
(
h2i
,
i2w
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
src/diff_patch.c
View file @
26c1cb91
...
...
@@ -202,7 +202,7 @@ static int diff_patch_invoke_file_callback(
if
(
!
output
->
file_cb
)
return
0
;
return
giterr_set_
callback
(
return
giterr_set_
after_callback_function
(
output
->
file_cb
(
patch
->
delta
,
progress
,
output
->
payload
),
"git_patch"
);
}
...
...
src/diff_print.c
View file @
26c1cb91
...
...
@@ -398,7 +398,7 @@ int git_diff_print(
diff
,
print_file
,
print_hunk
,
print_line
,
&
pi
);
if
(
error
)
/* make sure error message is set */
giterr_set_
callback
(
error
,
"git_diff_print"
);
giterr_set_
after_callback_function
(
error
,
"git_diff_print"
);
}
git_buf_free
(
&
buf
);
...
...
@@ -427,7 +427,7 @@ int git_patch_print(
diff_print_patch_line
,
&
pi
);
if
(
error
)
/* make sure error message is set */
giterr_set_
callback
(
error
,
"git_patch_print"
);
giterr_set_
after_callback_function
(
error
,
"git_patch_print"
);
}
git_buf_free
(
&
temp
);
...
...
src/fetchhead.c
View file @
26c1cb91
...
...
@@ -271,7 +271,7 @@ int git_repository_fetchhead_foreach(git_repository *repo,
error
=
cb
(
ref_name
,
remote_url
,
&
oid
,
is_merge
,
payload
);
if
(
error
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
goto
done
;
}
}
...
...
src/index.c
View file @
26c1cb91
...
...
@@ -2117,7 +2117,7 @@ int git_index_add_all(
if
(
error
>
0
)
/* return > 0 means skip this one */
continue
;
if
(
error
<
0
)
{
/* return < 0 means abort */
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
@@ -2204,10 +2204,8 @@ static int index_apply_to_all(
error
=
0
;
continue
;
}
if
(
error
<
0
)
{
/* return < 0 means abort */
giterr_set_callback
(
error
,
"git_index_matched_path"
);
if
(
error
<
0
)
/* return < 0 means abort */
break
;
}
}
/* index manipulation may alter entry, so don't depend on it */
...
...
@@ -2252,8 +2250,13 @@ int git_index_remove_all(
git_index_matched_path_cb
cb
,
void
*
payload
)
{
return
index_apply_to_all
(
int
error
=
index_apply_to_all
(
index
,
INDEX_ACTION_REMOVE
,
pathspec
,
cb
,
payload
);
if
(
error
)
/* make sure error is set if callback stopped iteration */
giterr_set_after_callback
(
error
);
return
error
;
}
int
git_index_update_all
(
...
...
@@ -2262,6 +2265,11 @@ int git_index_update_all(
git_index_matched_path_cb
cb
,
void
*
payload
)
{
return
index_apply_to_all
(
int
error
=
index_apply_to_all
(
index
,
INDEX_ACTION_UPDATE
,
pathspec
,
cb
,
payload
);
if
(
error
)
/* make sure error is set if callback stopped iteration */
giterr_set_after_callback
(
error
);
return
error
;
}
src/indexer.c
View file @
26c1cb91
...
...
@@ -387,7 +387,7 @@ on_error:
static
int
do_progress_callback
(
git_indexer
*
idx
,
git_transfer_progress
*
stats
)
{
if
(
idx
->
progress_cb
)
return
giterr_set_
callback
(
return
giterr_set_
after_callback_function
(
idx
->
progress_cb
(
stats
,
idx
->
progress_payload
),
"indexer progress"
);
return
0
;
...
...
src/merge.c
View file @
26c1cb91
...
...
@@ -288,7 +288,7 @@ int git_repository_mergehead_foreach(
goto
cleanup
;
if
((
error
=
cb
(
&
oid
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
goto
cleanup
;
}
...
...
src/notes.c
View file @
26c1cb91
...
...
@@ -584,7 +584,7 @@ int git_note_foreach(
while
(
!
(
error
=
git_note_next
(
&
note_id
,
&
annotated_id
,
iter
)))
{
if
((
error
=
note_cb
(
&
note_id
,
&
annotated_id
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
src/odb_loose.c
View file @
26c1cb91
...
...
@@ -733,7 +733,7 @@ static int foreach_object_dir_cb(void *_state, git_buf *path)
if
(
filename_to_oid
(
&
oid
,
path
->
ptr
+
state
->
dir_len
)
<
0
)
return
0
;
return
giterr_set_
callback
(
return
giterr_set_
after_callback_function
(
state
->
cb
(
&
oid
,
state
->
data
),
"git_odb_foreach"
);
}
...
...
src/pack-objects.c
View file @
26c1cb91
...
...
@@ -234,7 +234,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
pb
->
nr_objects
,
0
,
pb
->
progress_cb_payload
);
if
(
ret
)
return
GITERR_CALLBACK
(
ret
);
return
giterr_set_after_callback
(
ret
);
}
}
...
...
src/pack.c
View file @
26c1cb91
...
...
@@ -1088,10 +1088,8 @@ int git_pack_foreach_entry(
}
for
(
i
=
0
;
i
<
p
->
num_objects
;
i
++
)
if
((
error
=
cb
(
p
->
oids
[
i
],
data
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
break
;
}
if
((
error
=
cb
(
p
->
oids
[
i
],
data
))
!=
0
)
return
giterr_set_after_callback
(
error
);
return
error
;
}
...
...
src/path.c
View file @
26c1cb91
...
...
@@ -438,7 +438,7 @@ int git_path_walk_up(
iter
.
ptr
[
scan
]
=
oldc
;
if
(
error
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
...
...
@@ -882,7 +882,7 @@ int git_path_direach(
git_buf_truncate
(
path
,
wd_len
);
/* restore path */
if
(
error
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
src/push.c
View file @
26c1cb91
...
...
@@ -661,7 +661,7 @@ int git_push_status_foreach(git_push *push,
git_vector_foreach
(
&
push
->
status
,
i
,
status
)
{
int
error
=
cb
(
status
->
ref
,
status
->
msg
,
data
);
if
(
error
)
return
GITERR_CALLBACK
(
error
);
return
giterr_set_after_callback
(
error
);
}
return
0
;
...
...
src/refs.c
View file @
26c1cb91
...
...
@@ -518,7 +518,7 @@ int git_reference_foreach(
while
(
!
(
error
=
git_reference_next
(
&
ref
,
iter
)))
{
if
((
error
=
callback
(
ref
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
@@ -544,7 +544,7 @@ int git_reference_foreach_name(
while
(
!
(
error
=
git_reference_next_name
(
&
refname
,
iter
)))
{
if
((
error
=
callback
(
refname
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
@@ -571,7 +571,7 @@ int git_reference_foreach_glob(
while
(
!
(
error
=
git_reference_next_name
(
&
refname
,
iter
)))
{
if
((
error
=
callback
(
refname
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
src/remote.c
View file @
26c1cb91
...
...
@@ -1349,7 +1349,7 @@ static int rename_fetch_refspecs(
strcmp
(
git_buf_cstr
(
&
base
),
spec
->
string
))
{
if
((
error
=
callback
(
spec
->
string
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
...
...
src/stash.c
View file @
26c1cb91
...
...
@@ -588,7 +588,7 @@ int git_stash_foreach(
payload
);
if
(
error
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
src/status.c
View file @
26c1cb91
...
...
@@ -393,7 +393,7 @@ int git_status_foreach_ext(
status_entry
->
index_to_workdir
->
old_file
.
path
;
if
((
error
=
cb
(
path
,
status_entry
->
status
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
}
...
...
src/submodule.c
View file @
26c1cb91
...
...
@@ -169,7 +169,7 @@ int git_submodule_foreach(
}
if
((
error
=
callback
(
sm
,
sm
->
name
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
giterr_set_after_callback
(
error
);
break
;
}
});
...
...
src/tag.c
View file @
26c1cb91
...
...
@@ -426,8 +426,8 @@ static int tags_cb(const char *ref, void *data)
return
0
;
/* no tag */
if
(
!
(
error
=
git_reference_name_to_id
(
&
oid
,
d
->
repo
,
ref
)))
{
error
=
d
->
cb
(
ref
,
&
oid
,
d
->
cb_data
);
giterr_set_callback
(
error
,
"git_tag_foreach"
);
if
((
error
=
d
->
cb
(
ref
,
&
oid
,
d
->
cb_data
))
!=
0
)
giterr_set_after_callback_function
(
error
,
"git_tag_foreach"
);
}
return
error
;
...
...
src/tree.c
View file @
26c1cb91
...
...
@@ -883,9 +883,12 @@ static int tree_walk(
git_vector_foreach
(
&
tree
->
entries
,
i
,
entry
)
{
if
(
preorder
)
{
if
((
error
=
callback
(
path
->
ptr
,
entry
,
payload
))
<
0
)
return
giterr_set_callback
(
error
,
"git_tree_walk"
);
if
(
error
>
0
)
{
error
=
callback
(
path
->
ptr
,
entry
,
payload
);
if
(
error
<
0
)
{
/* negative value stops iteration */
giterr_set_after_callback_function
(
error
,
"git_tree_walk"
);
break
;
}
if
(
error
>
0
)
{
/* positive value skips this entry */
error
=
0
;
continue
;
}
...
...
@@ -916,8 +919,11 @@ static int tree_walk(
}
if
(
!
preorder
)
{
if
((
error
=
callback
(
path
->
ptr
,
entry
,
payload
))
<
0
)
return
giterr_set_callback
(
error
,
"git_tree_walk"
);
error
=
callback
(
path
->
ptr
,
entry
,
payload
);
if
(
error
<
0
)
{
/* negative value stops iteration */
giterr_set_after_callback_function
(
error
,
"git_tree_walk"
);
break
;
}
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