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
2dae54a9
Commit
2dae54a9
authored
Oct 19, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve clone sample's formatting
parent
9c05c17b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
examples/network/clone.c
+6
-9
src/checkout.c
+2
-1
No files found.
examples/network/clone.c
View file @
2dae54a9
...
...
@@ -19,17 +19,14 @@ static void print_progress(const progress_data *pd)
int
network_percent
=
(
100
*
pd
->
fetch_progress
.
received
)
/
pd
->
fetch_progress
.
total
;
int
index_percent
=
(
100
*
pd
->
fetch_progress
.
processed
)
/
pd
->
fetch_progress
.
total
;
int
checkout_percent
=
pd
->
total_steps
>
0
?
(
100
.
f
*
pd
->
completed_steps
)
/
pd
->
total_steps
?
(
100
*
pd
->
completed_steps
)
/
pd
->
total_steps
:
0
.
f
;
int
kbytes
=
pd
->
fetch_progress
.
bytes
/
1024
;
printf
(
"net %3d%% (%6d kb) / idx %3d%% / chk %3d%% %50s
\n
"
,
network_percent
,
kbytes
,
index_percent
,
checkout_percent
,
pd
->
path
);
/*
printf("net %5d /%5d – idx %5d /%5d – chk %.04f %20s\n",
pd->fetch_progress.received, pd->fetch_progress.total,
pd->fetch_progress.processed, pd->fetch_progress.total,
pd->checkout_progress, pd->path);
*/
printf
(
"net %3d%% (%4d kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4lu/%4lu) %s
\n
"
,
network_percent
,
kbytes
,
pd
->
fetch_progress
.
received
,
pd
->
fetch_progress
.
total
,
index_percent
,
pd
->
fetch_progress
.
processed
,
pd
->
fetch_progress
.
total
,
checkout_percent
,
pd
->
completed_steps
,
pd
->
total_steps
,
pd
->
path
);
}
static
void
fetch_progress
(
const
git_indexer_stats
*
stats
,
void
*
payload
)
...
...
src/checkout.c
View file @
2dae54a9
...
...
@@ -192,7 +192,6 @@ static int checkout_blob(
error
=
blob_content_to_file
(
blob
,
git_buf_cstr
(
data
->
path
),
file
->
mode
,
data
->
checkout_opts
);
report_progress
(
data
,
file
->
path
);
git_blob_free
(
blob
);
return
error
;
...
...
@@ -265,11 +264,13 @@ static int checkout_create_the_new(
if
(
!
is_submodule
&&
!
data
->
create_submodules
)
{
error
=
checkout_blob
(
data
,
&
delta
->
old_file
);
data
->
completed_steps
++
;
report_progress
(
data
,
delta
->
old_file
.
path
);
}
else
if
(
is_submodule
&&
data
->
create_submodules
)
{
error
=
checkout_submodule
(
data
,
&
delta
->
old_file
);
data
->
completed_steps
++
;
report_progress
(
data
,
delta
->
old_file
.
path
);
}
}
...
...
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