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
04bdd97f
Commit
04bdd97f
authored
Jan 12, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2815 from ethomson/example
clone example: don't divide by zero
parents
b91f28be
9af3c416
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
examples/network/clone.c
+9
-3
No files found.
examples/network/clone.c
View file @
04bdd97f
...
@@ -18,14 +18,20 @@ typedef struct progress_data {
...
@@ -18,14 +18,20 @@ typedef struct progress_data {
static
void
print_progress
(
const
progress_data
*
pd
)
static
void
print_progress
(
const
progress_data
*
pd
)
{
{
int
network_percent
=
(
100
*
pd
->
fetch_progress
.
received_objects
)
/
pd
->
fetch_progress
.
total_objects
;
int
network_percent
=
pd
->
fetch_progress
.
total_objects
>
0
?
int
index_percent
=
(
100
*
pd
->
fetch_progress
.
indexed_objects
)
/
pd
->
fetch_progress
.
total_objects
;
(
100
*
pd
->
fetch_progress
.
received_objects
)
/
pd
->
fetch_progress
.
total_objects
:
0
;
int
index_percent
=
pd
->
fetch_progress
.
total_objects
>
0
?
(
100
*
pd
->
fetch_progress
.
indexed_objects
)
/
pd
->
fetch_progress
.
total_objects
:
0
;
int
checkout_percent
=
pd
->
total_steps
>
0
int
checkout_percent
=
pd
->
total_steps
>
0
?
(
100
*
pd
->
completed_steps
)
/
pd
->
total_steps
?
(
100
*
pd
->
completed_steps
)
/
pd
->
total_steps
:
0
;
:
0
;
int
kbytes
=
pd
->
fetch_progress
.
received_bytes
/
1024
;
int
kbytes
=
pd
->
fetch_progress
.
received_bytes
/
1024
;
if
(
pd
->
fetch_progress
.
received_objects
==
pd
->
fetch_progress
.
total_objects
)
{
if
(
pd
->
fetch_progress
.
total_objects
&&
pd
->
fetch_progress
.
received_objects
==
pd
->
fetch_progress
.
total_objects
)
{
printf
(
"Resolving deltas %d/%d
\r
"
,
printf
(
"Resolving deltas %d/%d
\r
"
,
pd
->
fetch_progress
.
indexed_deltas
,
pd
->
fetch_progress
.
indexed_deltas
,
pd
->
fetch_progress
.
total_deltas
);
pd
->
fetch_progress
.
total_deltas
);
...
...
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