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
2b28ee77
Unverified
Commit
2b28ee77
authored
Jun 11, 2022
by
Edward Thomson
Committed by
GitHub
Jun 11, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6319 from libgit2/ethomson/progress_32bit
CLI: progress updates
parents
28d2ea1d
3a737169
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
src/cli/progress.c
+20
-5
src/cli/progress.h
+4
-0
No files found.
src/cli/progress.c
View file @
2b28ee77
...
...
@@ -12,7 +12,13 @@
#include "progress.h"
#include "error.h"
#define PROGRESS_UPDATE_TIME 0.05
/*
* Show updates to the percentage and number of objects received
* separately from the throughput to give an accurate progress while
* avoiding too much noise on the screen.
*/
#define PROGRESS_UPDATE_TIME 0.10
#define THROUGHPUT_UPDATE_TIME 1.00
#define is_nl(c) ((c) == '\r' || (c) == '\n')
...
...
@@ -200,11 +206,20 @@ static int fetch_receiving(
else
now
=
git__timer
();
recv_len
=
(
double
)
stats
->
received_bytes
;
if
(
progress
->
throughput_update
&&
now
-
progress
->
throughput_update
<
THROUGHPUT_UPDATE_TIME
)
{
elapsed
=
progress
->
throughput_update
-
progress
->
action_start
;
recv_len
=
progress
->
throughput_bytes
;
}
else
{
elapsed
=
now
-
progress
->
action_start
;
recv_len
=
(
double
)
stats
->
received_bytes
;
progress
->
throughput_update
=
now
;
progress
->
throughput_bytes
=
recv_len
;
}
elapsed
=
now
-
progress
->
action_start
;
rate
=
elapsed
?
recv_len
/
elapsed
:
0
;
done
=
(
stats
->
received_objects
==
stats
->
total_objects
);
while
(
recv_len
>
1024
&&
recv_units
[
recv_unit_idx
+
1
])
{
recv_len
/=
1024
;
...
...
@@ -295,7 +310,7 @@ void cli_progress_checkout(
}
progress_printf
(
progress
,
false
,
"Checking out files: %3d%% (%
lu/%lu
)%s
\r
"
,
"Checking out files: %3d%% (%
"
PRIuZ
"/%"
PRIuZ
"
)%s
\r
"
,
percent
(
completed_steps
,
total_steps
),
completed_steps
,
total_steps
,
done
?
", done."
:
""
);
...
...
src/cli/progress.h
View file @
2b28ee77
...
...
@@ -40,6 +40,10 @@ typedef struct {
git_str
sideband
;
git_str
onscreen
;
git_str
deferred
;
/* Last update about throughput */
double
throughput_update
;
double
throughput_bytes
;
}
cli_progress
;
#define CLI_PROGRESS_INIT { 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