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
c7b3e1b3
Commit
c7b3e1b3
authored
Dec 06, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some callback error check style cleanups
I find this easier to read...
parent
60058018
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
52 additions
and
28 deletions
+52
-28
src/attr.c
+4
-3
src/diff.c
+3
-1
src/fetchhead.c
+6
-5
src/merge.c
+3
-1
src/pack-objects.c
+5
-2
src/pack.c
+3
-1
src/path.c
+9
-4
src/push.c
+3
-2
src/remote.c
+4
-2
src/stash.c
+6
-4
src/status.c
+3
-2
src/submodule.c
+3
-1
No files found.
src/attr.c
View file @
c7b3e1b3
...
...
@@ -191,13 +191,14 @@ int git_attr_foreach(
if
(
error
<
0
)
goto
cleanup
;
error
=
GITERR_CALLBACK
(
callback
(
assign
->
name
,
assign
->
value
,
payload
)
);
if
(
error
)
error
=
callback
(
assign
->
name
,
assign
->
value
,
payload
);
if
(
error
)
{
GITERR_CALLBACK
(
error
);
goto
cleanup
;
}
}
}
}
cleanup:
git_strmap_free
(
seen
);
...
...
src/diff.c
View file @
c7b3e1b3
...
...
@@ -1388,9 +1388,11 @@ int git_diff__paired_foreach(
i
++
;
j
++
;
}
if
((
error
=
GITERR_CALLBACK
(
cb
(
h2i
,
i2w
,
payload
)
))
!=
0
)
if
((
error
=
cb
(
h2i
,
i2w
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
break
;
}
}
/* restore case-insensitive delta sort */
if
(
icase_mismatch
&&
h2i_icase
)
{
...
...
src/fetchhead.c
View file @
c7b3e1b3
...
...
@@ -260,8 +260,8 @@ int git_repository_fetchhead_foreach(git_repository *repo,
while
((
line
=
git__strsep
(
&
buffer
,
"
\n
"
))
!=
NULL
)
{
++
line_num
;
if
((
error
=
fetchhead_ref_parse
(
&
oid
,
&
is_merge
,
&
name
,
&
remote_url
,
line
,
line_num
))
<
0
)
if
((
error
=
fetchhead_ref_parse
(
&
oid
,
&
is_merge
,
&
name
,
&
remote_url
,
line
,
line_num
))
<
0
)
goto
done
;
if
(
git_buf_len
(
&
name
)
>
0
)
...
...
@@ -269,11 +269,12 @@ int git_repository_fetchhead_foreach(git_repository *repo,
else
ref_name
=
NULL
;
error
=
GITERR_CALLBACK
(
cb
(
ref_name
,
remote_url
,
&
oid
,
is_merge
,
payload
)
);
if
(
error
)
error
=
cb
(
ref_name
,
remote_url
,
&
oid
,
is_merge
,
payload
);
if
(
error
)
{
GITERR_CALLBACK
(
error
);
goto
done
;
}
}
if
(
*
buffer
)
{
giterr_set
(
GITERR_FETCHHEAD
,
"No EOL at line %d"
,
line_num
+
1
);
...
...
src/merge.c
View file @
c7b3e1b3
...
...
@@ -287,8 +287,10 @@ int git_repository_mergehead_foreach(
if
((
error
=
git_oid_fromstr
(
&
oid
,
line
))
<
0
)
goto
cleanup
;
if
((
error
=
GITERR_CALLBACK
(
cb
(
&
oid
,
payload
)
))
!=
0
)
if
((
error
=
cb
(
&
oid
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
goto
cleanup
;
}
++
line_num
;
}
...
...
src/pack-objects.c
View file @
c7b3e1b3
...
...
@@ -229,9 +229,12 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
if
(
elapsed
>=
MIN_PROGRESS_UPDATE_INTERVAL
)
{
pb
->
last_progress_report_time
=
current_time
;
ret
urn
GITERR_CALLBACK
(
pb
->
progress_cb
(
ret
=
pb
->
progress_cb
(
GIT_PACKBUILDER_ADDING_OBJECTS
,
pb
->
nr_objects
,
0
,
pb
->
progress_cb_payload
)
);
pb
->
nr_objects
,
0
,
pb
->
progress_cb_payload
);
if
(
ret
)
return
GITERR_CALLBACK
(
ret
);
}
}
...
...
src/pack.c
View file @
c7b3e1b3
...
...
@@ -1088,8 +1088,10 @@ int git_pack_foreach_entry(
}
for
(
i
=
0
;
i
<
p
->
num_objects
;
i
++
)
if
((
error
=
GITERR_CALLBACK
(
cb
(
p
->
oids
[
i
],
data
)
))
!=
0
)
if
((
error
=
cb
(
p
->
oids
[
i
],
data
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
break
;
}
return
error
;
}
...
...
src/path.c
View file @
c7b3e1b3
...
...
@@ -434,10 +434,13 @@ int git_path_walk_up(
iter
.
asize
=
path
->
asize
;
while
(
scan
>=
stop
)
{
error
=
GITERR_CALLBACK
(
cb
(
data
,
&
iter
)
);
error
=
cb
(
data
,
&
iter
);
iter
.
ptr
[
scan
]
=
oldc
;
if
(
error
)
if
(
error
)
{
GITERR_CALLBACK
(
error
);
break
;
}
scan
=
git_buf_rfind_next
(
&
iter
,
'/'
);
if
(
scan
>=
0
)
{
...
...
@@ -874,13 +877,15 @@ int git_path_direach(
if
((
error
=
git_buf_put
(
path
,
de_path
,
de_len
))
<
0
)
break
;
error
=
GITERR_CALLBACK
(
fn
(
arg
,
path
)
);
error
=
fn
(
arg
,
path
);
git_buf_truncate
(
path
,
wd_len
);
/* restore path */
if
(
error
)
if
(
error
!=
0
)
{
GITERR_CALLBACK
(
error
);
break
;
}
}
closedir
(
dir
);
...
...
src/push.c
View file @
c7b3e1b3
...
...
@@ -659,8 +659,9 @@ int git_push_status_foreach(git_push *push,
unsigned
int
i
;
git_vector_foreach
(
&
push
->
status
,
i
,
status
)
{
GITERR_CHECK_ERROR
(
GITERR_CALLBACK
(
cb
(
status
->
ref
,
status
->
msg
,
data
)
)
);
int
error
=
cb
(
status
->
ref
,
status
->
msg
,
data
);
if
(
error
)
return
GITERR_CALLBACK
(
error
);
}
return
0
;
...
...
src/remote.c
View file @
c7b3e1b3
...
...
@@ -1348,9 +1348,11 @@ static int rename_fetch_refspecs(
if
(
!
remote
->
name
||
strcmp
(
git_buf_cstr
(
&
base
),
spec
->
string
))
{
error
=
GITERR_CALLBACK
(
callback
(
spec
->
string
,
payload
)
);
if
(
error
)
if
((
error
=
callback
(
spec
->
string
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
break
;
}
continue
;
}
...
...
src/stash.c
View file @
c7b3e1b3
...
...
@@ -582,14 +582,16 @@ int git_stash_foreach(
for
(
i
=
0
;
i
<
max
;
i
++
)
{
entry
=
git_reflog_entry_byindex
(
reflog
,
i
);
error
=
GITERR_CALLBACK
(
callback
(
i
,
error
=
callback
(
i
,
git_reflog_entry_message
(
entry
),
git_reflog_entry_id_new
(
entry
),
payload
)
);
if
(
error
)
payload
);
if
(
error
)
{
GITERR_CALLBACK
(
error
);
break
;
}
}
cleanup:
git_reference_free
(
stash
);
...
...
src/status.c
View file @
c7b3e1b3
...
...
@@ -392,10 +392,11 @@ int git_status_foreach_ext(
status_entry
->
head_to_index
->
old_file
.
path
:
status_entry
->
index_to_workdir
->
old_file
.
path
;
error
=
GITERR_CALLBACK
(
cb
(
path
,
status_entry
->
status
,
payload
)
);
if
(
error
)
if
((
error
=
cb
(
path
,
status_entry
->
status
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
break
;
}
}
git_status_list_free
(
status
);
...
...
src/submodule.c
View file @
c7b3e1b3
...
...
@@ -168,8 +168,10 @@ int git_submodule_foreach(
break
;
}
if
((
error
=
GITERR_CALLBACK
(
callback
(
sm
,
sm
->
name
,
payload
)))
!=
0
)
if
((
error
=
callback
(
sm
,
sm
->
name
,
payload
))
!=
0
)
{
GITERR_CALLBACK
(
error
);
break
;
}
});
git_vector_free
(
&
seen
);
...
...
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