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
5a6a3c00
Unverified
Commit
5a6a3c00
authored
Feb 22, 2019
by
Edward Thomson
Committed by
GitHub
Feb 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4997 from libgit2/ethomson/transfer_progress
Rename git_transfer_progress to git_indexer_progress
parents
4069f924
ca909da5
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
155 additions
and
105 deletions
+155
-105
examples/clone.c
+2
-2
examples/fetch.c
+2
-2
examples/index-pack.c
+2
-2
fuzzers/packfile_fuzzer.c
+1
-1
include/git2/deprecated.h
+38
-0
include/git2/indexer.h
+44
-3
include/git2/odb.h
+1
-1
include/git2/odb_backend.h
+2
-2
include/git2/pack.h
+1
-1
include/git2/remote.h
+5
-4
include/git2/sys/odb_backend.h
+1
-1
include/git2/sys/transport.h
+2
-2
include/git2/types.h
+0
-30
src/fetch.c
+1
-1
src/indexer.c
+8
-8
src/odb.c
+1
-1
src/odb_pack.c
+3
-3
src/pack-objects.c
+3
-3
src/remote.c
+1
-1
src/remote.h
+1
-1
src/transports/local.c
+5
-5
src/transports/smart.h
+2
-2
src/transports/smart_protocol.c
+12
-12
tests/clone/nonetwork.c
+1
-1
tests/network/fetchlocal.c
+1
-1
tests/online/clone.c
+2
-2
tests/online/fetch.c
+3
-3
tests/pack/indexer.c
+7
-7
tests/pack/packbuilder.c
+3
-3
No files found.
examples/clone.c
View file @
5a6a3c00
#include "common.h"
typedef
struct
progress_data
{
git_
transf
er_progress
fetch_progress
;
git_
index
er_progress
fetch_progress
;
size_t
completed_steps
;
size_t
total_steps
;
const
char
*
path
;
...
...
@@ -46,7 +46,7 @@ static int sideband_progress(const char *str, int len, void *payload)
return
0
;
}
static
int
fetch_progress
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
fetch_progress
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
progress_data
*
pd
=
(
progress_data
*
)
payload
;
pd
->
fetch_progress
=
*
stats
;
...
...
examples/fetch.c
View file @
5a6a3c00
...
...
@@ -38,7 +38,7 @@ static int update_cb(const char *refname, const git_oid *a, const git_oid *b, vo
* data. Most frontends will probably want to show a percentage and
* the download rate.
*/
static
int
transfer_progress_cb
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
transfer_progress_cb
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
(
void
)
payload
;
...
...
@@ -57,7 +57,7 @@ static int transfer_progress_cb(const git_transfer_progress *stats, void *payloa
int
lg2_fetch
(
git_repository
*
repo
,
int
argc
,
char
**
argv
)
{
git_remote
*
remote
=
NULL
;
const
git_
transf
er_progress
*
stats
;
const
git_
index
er_progress
*
stats
;
git_fetch_options
fetch_opts
=
GIT_FETCH_OPTIONS_INIT
;
if
(
argc
<
2
)
{
...
...
examples/index-pack.c
View file @
5a6a3c00
...
...
@@ -20,7 +20,7 @@
* This could be run in the main loop whilst the application waits for
* the indexing to finish in a worker thread
*/
static
int
index_cb
(
const
git_
transf
er_progress
*
stats
,
void
*
data
)
static
int
index_cb
(
const
git_
index
er_progress
*
stats
,
void
*
data
)
{
(
void
)
data
;
printf
(
"
\r
Processing %d of %d"
,
stats
->
indexed_objects
,
stats
->
total_objects
);
...
...
@@ -31,7 +31,7 @@ static int index_cb(const git_transfer_progress *stats, void *data)
int
lg2_index_pack
(
git_repository
*
repo
,
int
argc
,
char
**
argv
)
{
git_indexer
*
idx
;
git_
transf
er_progress
stats
=
{
0
,
0
};
git_
index
er_progress
stats
=
{
0
,
0
};
int
error
;
char
hash
[
GIT_OID_HEXSZ
+
1
]
=
{
0
};
int
fd
;
...
...
fuzzers/packfile_fuzzer.c
View file @
5a6a3c00
...
...
@@ -55,7 +55,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
{
git_indexer
*
indexer
=
NULL
;
git_
transf
er_progress
stats
=
{
0
,
0
};
git_
index
er_progress
stats
=
{
0
,
0
};
bool
append_hash
=
false
;
git_oid
id
;
char
hash
[
GIT_OID_HEXSZ
+
1
]
=
{
0
};
...
...
include/git2/deprecated.h
View file @
5a6a3c00
...
...
@@ -13,6 +13,7 @@
#include "index.h"
#include "object.h"
#include "refs.h"
#include "remote.h"
/*
* Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
...
...
@@ -245,6 +246,43 @@ GIT_EXTERN(void) giterr_set_oom(void);
/**@}*/
/** @name Deprecated Transfer Progress Types
*
* These types are retained for backward compatibility. The newer
* versions of these values should be preferred in all new code.
*
* There is no plan to remove these backward compatibility values at
* this time.
*/
/**@{*/
/**
* This structure is used to provide callers information about the
* progress of indexing a packfile.
*
* This type is deprecated, but there is no plan to remove this
* type definition at this time.
*/
typedef
git_indexer_progress
git_transfer_progress
;
/**
* Type definition for progress callbacks during indexing.
*
* This type is deprecated, but there is no plan to remove this
* type definition at this time.
*/
typedef
git_indexer_progress_cb
git_transfer_progress_cb
;
/**
* Type definition for push transfer progress callbacks.
*
* This type is deprecated, but there is no plan to remove this
* type definition at this time.
*/
typedef
git_push_transfer_progress_cb
git_push_transfer_progress
;
/**@}*/
/** @} */
GIT_END_DECL
...
...
include/git2/indexer.h
View file @
5a6a3c00
...
...
@@ -15,11 +15,52 @@ GIT_BEGIN_DECL
typedef
struct
git_indexer
git_indexer
;
/**
* This structure is used to provide callers information about the
* progress of indexing a packfile, either directly or part of a
* fetch or clone that downloads a packfile.
*/
typedef
struct
git_indexer_progress
{
/** number of objects in the packfile being indexed */
unsigned
int
total_objects
;
/** received objects that have been hashed */
unsigned
int
indexed_objects
;
/** received_objects: objects which have been downloaded */
unsigned
int
received_objects
;
/**
* locally-available objects that have been injected in order
* to fix a thin pack
*/
unsigned
int
local_objects
;
/** number of deltas in the packfile being indexed */
unsigned
int
total_deltas
;
/** received deltas that have been indexed */
unsigned
int
indexed_deltas
;
/** size of the packfile received up to now */
size_t
received_bytes
;
}
git_indexer_progress
;
/**
* Type for progress callbacks during indexing. Return a value less
* than zero to cancel the indexing or download.
*
* @param stats Structure containing information about the state of the tran sfer
* @param payload Payload provided by caller
*/
typedef
int
GIT_CALLBACK
(
git_indexer_progress_cb
)(
const
git_indexer_progress
*
stats
,
void
*
payload
);
typedef
struct
git_indexer_options
{
unsigned
int
version
;
/** progress_cb function to call with progress information */
git_
transf
er_progress_cb
progress_cb
;
git_
index
er_progress_cb
progress_cb
;
/** progress_cb_payload payload for the progress callback */
void
*
progress_cb_payload
;
...
...
@@ -69,7 +110,7 @@ GIT_EXTERN(int) git_indexer_new(
* @param size the size of the data in bytes
* @param stats stat storage
*/
GIT_EXTERN
(
int
)
git_indexer_append
(
git_indexer
*
idx
,
const
void
*
data
,
size_t
size
,
git_
transf
er_progress
*
stats
);
GIT_EXTERN
(
int
)
git_indexer_append
(
git_indexer
*
idx
,
const
void
*
data
,
size_t
size
,
git_
index
er_progress
*
stats
);
/**
* Finalize the pack and index
...
...
@@ -78,7 +119,7 @@ GIT_EXTERN(int) git_indexer_append(git_indexer *idx, const void *data, size_t si
*
* @param idx the indexer
*/
GIT_EXTERN
(
int
)
git_indexer_commit
(
git_indexer
*
idx
,
git_
transf
er_progress
*
stats
);
GIT_EXTERN
(
int
)
git_indexer_commit
(
git_indexer
*
idx
,
git_
index
er_progress
*
stats
);
/**
* Get the packfile's hash
...
...
include/git2/odb.h
View file @
5a6a3c00
...
...
@@ -391,7 +391,7 @@ GIT_EXTERN(int) git_odb_open_rstream(
GIT_EXTERN
(
int
)
git_odb_write_pack
(
git_odb_writepack
**
out
,
git_odb
*
db
,
git_
transf
er_progress_cb
progress_cb
,
git_
index
er_progress_cb
progress_cb
,
void
*
progress_payload
);
/**
...
...
include/git2/odb_backend.h
View file @
5a6a3c00
...
...
@@ -124,8 +124,8 @@ struct git_odb_stream {
struct
git_odb_writepack
{
git_odb_backend
*
backend
;
int
GIT_CALLBACK
(
append
)(
git_odb_writepack
*
writepack
,
const
void
*
data
,
size_t
size
,
git_
transf
er_progress
*
stats
);
int
GIT_CALLBACK
(
commit
)(
git_odb_writepack
*
writepack
,
git_
transf
er_progress
*
stats
);
int
GIT_CALLBACK
(
append
)(
git_odb_writepack
*
writepack
,
const
void
*
data
,
size_t
size
,
git_
index
er_progress
*
stats
);
int
GIT_CALLBACK
(
commit
)(
git_odb_writepack
*
writepack
,
git_
index
er_progress
*
stats
);
void
GIT_CALLBACK
(
free
)(
git_odb_writepack
*
writepack
);
};
...
...
include/git2/pack.h
View file @
5a6a3c00
...
...
@@ -165,7 +165,7 @@ GIT_EXTERN(int) git_packbuilder_write(
git_packbuilder
*
pb
,
const
char
*
path
,
unsigned
int
mode
,
git_
transf
er_progress_cb
progress_cb
,
git_
index
er_progress_cb
progress_cb
,
void
*
progress_cb_payload
);
/**
...
...
include/git2/remote.h
View file @
5a6a3c00
...
...
@@ -422,11 +422,12 @@ typedef enum git_remote_completion_type {
}
git_remote_completion_type
;
/** Push network progress notification function */
typedef
int
GIT_CALLBACK
(
git_push_transfer_progress
)(
typedef
int
GIT_CALLBACK
(
git_push_transfer_progress
_cb
)(
unsigned
int
current
,
unsigned
int
total
,
size_t
bytes
,
void
*
payload
);
/**
* Represents an update which will be performed on the remote during push
*/
...
...
@@ -516,7 +517,7 @@ struct git_remote_callbacks {
* called with the current count of progress done by the
* indexer.
*/
git_
transf
er_progress_cb
transfer_progress
;
git_
index
er_progress_cb
transfer_progress
;
/**
* Each time a reference is updated locally, this function
...
...
@@ -537,7 +538,7 @@ struct git_remote_callbacks {
* inline with pack building operations, so performance may be
* affected.
*/
git_push_transfer_progress
push_transfer_progress
;
git_push_transfer_progress
_cb
push_transfer_progress
;
/**
* See documentation of git_push_update_reference_cb
...
...
@@ -832,7 +833,7 @@ GIT_EXTERN(int) git_remote_push(git_remote *remote,
/**
* Get the statistics structure that is filled in by the fetch operation.
*/
GIT_EXTERN
(
const
git_
transf
er_progress
*
)
git_remote_stats
(
git_remote
*
remote
);
GIT_EXTERN
(
const
git_
index
er_progress
*
)
git_remote_stats
(
git_remote
*
remote
);
/**
* Retrieve the tag auto-follow setting
...
...
include/git2/sys/odb_backend.h
View file @
5a6a3c00
...
...
@@ -82,7 +82,7 @@ struct git_odb_backend {
int
GIT_CALLBACK
(
writepack
)(
git_odb_writepack
**
,
git_odb_backend
*
,
git_odb
*
odb
,
git_
transf
er_progress_cb
progress_cb
,
void
*
progress_payload
);
git_
index
er_progress_cb
progress_cb
,
void
*
progress_payload
);
/**
* "Freshens" an already existing object, updating its last-used
...
...
include/git2/sys/transport.h
View file @
5a6a3c00
...
...
@@ -98,8 +98,8 @@ struct git_transport {
int
GIT_CALLBACK
(
download_pack
)(
git_transport
*
transport
,
git_repository
*
repo
,
git_
transf
er_progress
*
stats
,
git_
transf
er_progress_cb
progress_cb
,
git_
index
er_progress
*
stats
,
git_
index
er_progress_cb
progress_cb
,
void
*
progress_payload
);
/** Checks to see if the transport is connected */
...
...
include/git2/types.h
View file @
5a6a3c00
...
...
@@ -245,36 +245,6 @@ typedef struct git_remote_head git_remote_head;
typedef
struct
git_remote_callbacks
git_remote_callbacks
;
/**
* This is passed as the first argument to the callback to allow the
* user to see the progress.
*
* - total_objects: number of objects in the packfile being downloaded
* - indexed_objects: received objects that have been hashed
* - received_objects: objects which have been downloaded
* - local_objects: locally-available objects that have been injected
* in order to fix a thin pack.
* - received-bytes: size of the packfile received up to now
*/
typedef
struct
git_transfer_progress
{
unsigned
int
total_objects
;
unsigned
int
indexed_objects
;
unsigned
int
received_objects
;
unsigned
int
local_objects
;
unsigned
int
total_deltas
;
unsigned
int
indexed_deltas
;
size_t
received_bytes
;
}
git_transfer_progress
;
/**
* Type for progress callbacks during indexing. Return a value less than zero
* to cancel the transfer.
*
* @param stats Structure containing information about the state of the transfer
* @param payload Payload provided by caller
*/
typedef
int
GIT_CALLBACK
(
git_transfer_progress_cb
)(
const
git_transfer_progress
*
stats
,
void
*
payload
);
/**
* Type for messages delivered by the transport. Return a negative value
* to cancel the network operation.
*
...
...
src/fetch.c
View file @
5a6a3c00
...
...
@@ -134,7 +134,7 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
int
git_fetch_download_pack
(
git_remote
*
remote
,
const
git_remote_callbacks
*
callbacks
)
{
git_transport
*
t
=
remote
->
transport
;
git_
transf
er_progress_cb
progress
=
NULL
;
git_
index
er_progress_cb
progress
=
NULL
;
void
*
payload
=
NULL
;
if
(
!
remote
->
need_pack
)
...
...
src/indexer.c
View file @
5a6a3c00
...
...
@@ -58,7 +58,7 @@ struct git_indexer {
unsigned
int
fanout
[
256
];
git_hash_ctx
hash_ctx
;
git_oid
hash
;
git_
transf
er_progress_cb
progress_cb
;
git_
index
er_progress_cb
progress_cb
;
void
*
progress_payload
;
char
objbuf
[
8
*
1024
];
...
...
@@ -544,7 +544,7 @@ on_error:
return
-
1
;
}
static
int
do_progress_callback
(
git_indexer
*
idx
,
git_
transf
er_progress
*
stats
)
static
int
do_progress_callback
(
git_indexer
*
idx
,
git_
index
er_progress
*
stats
)
{
if
(
idx
->
progress_cb
)
return
git_error_set_after_callback_function
(
...
...
@@ -652,7 +652,7 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
return
write_at
(
idx
,
data
,
idx
->
pack
->
mwf
.
size
,
size
);
}
static
int
read_stream_object
(
git_indexer
*
idx
,
git_
transf
er_progress
*
stats
)
static
int
read_stream_object
(
git_indexer
*
idx
,
git_
index
er_progress
*
stats
)
{
git_packfile_stream
*
stream
=
&
idx
->
stream
;
git_off_t
entry_start
=
idx
->
off
;
...
...
@@ -741,7 +741,7 @@ static int read_stream_object(git_indexer *idx, git_transfer_progress *stats)
return
0
;
}
int
git_indexer_append
(
git_indexer
*
idx
,
const
void
*
data
,
size_t
size
,
git_
transf
er_progress
*
stats
)
int
git_indexer_append
(
git_indexer
*
idx
,
const
void
*
data
,
size_t
size
,
git_
index
er_progress
*
stats
)
{
int
error
=
-
1
;
struct
git_pack_header
*
hdr
=
&
idx
->
hdr
;
...
...
@@ -925,7 +925,7 @@ cleanup:
return
error
;
}
static
int
fix_thin_pack
(
git_indexer
*
idx
,
git_
transf
er_progress
*
stats
)
static
int
fix_thin_pack
(
git_indexer
*
idx
,
git_
index
er_progress
*
stats
)
{
int
error
,
found_ref_delta
=
0
;
unsigned
int
i
;
...
...
@@ -987,7 +987,7 @@ static int fix_thin_pack(git_indexer *idx, git_transfer_progress *stats)
return
0
;
}
static
int
resolve_deltas
(
git_indexer
*
idx
,
git_
transf
er_progress
*
stats
)
static
int
resolve_deltas
(
git_indexer
*
idx
,
git_
index
er_progress
*
stats
)
{
unsigned
int
i
;
int
error
;
...
...
@@ -1044,7 +1044,7 @@ static int resolve_deltas(git_indexer *idx, git_transfer_progress *stats)
return
0
;
}
static
int
update_header_and_rehash
(
git_indexer
*
idx
,
git_
transf
er_progress
*
stats
)
static
int
update_header_and_rehash
(
git_indexer
*
idx
,
git_
index
er_progress
*
stats
)
{
void
*
ptr
;
size_t
chunk
=
1024
*
1024
;
...
...
@@ -1085,7 +1085,7 @@ static int update_header_and_rehash(git_indexer *idx, git_transfer_progress *sta
return
0
;
}
int
git_indexer_commit
(
git_indexer
*
idx
,
git_
transf
er_progress
*
stats
)
int
git_indexer_commit
(
git_indexer
*
idx
,
git_
index
er_progress
*
stats
)
{
git_mwindow
*
w
=
NULL
;
unsigned
int
i
,
long_offsets
=
0
,
left
;
...
...
src/odb.c
View file @
5a6a3c00
...
...
@@ -1468,7 +1468,7 @@ int git_odb_open_rstream(
return
error
;
}
int
git_odb_write_pack
(
struct
git_odb_writepack
**
out
,
git_odb
*
db
,
git_
transf
er_progress_cb
progress_cb
,
void
*
progress_payload
)
int
git_odb_write_pack
(
struct
git_odb_writepack
**
out
,
git_odb
*
db
,
git_
index
er_progress_cb
progress_cb
,
void
*
progress_payload
)
{
size_t
i
,
writes
=
0
;
int
error
=
GIT_ERROR
;
...
...
src/odb_pack.c
View file @
5a6a3c00
...
...
@@ -485,7 +485,7 @@ static int pack_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb c
return
0
;
}
static
int
pack_backend__writepack_append
(
struct
git_odb_writepack
*
_writepack
,
const
void
*
data
,
size_t
size
,
git_
transf
er_progress
*
stats
)
static
int
pack_backend__writepack_append
(
struct
git_odb_writepack
*
_writepack
,
const
void
*
data
,
size_t
size
,
git_
index
er_progress
*
stats
)
{
struct
pack_writepack
*
writepack
=
(
struct
pack_writepack
*
)
_writepack
;
...
...
@@ -494,7 +494,7 @@ static int pack_backend__writepack_append(struct git_odb_writepack *_writepack,
return
git_indexer_append
(
writepack
->
indexer
,
data
,
size
,
stats
);
}
static
int
pack_backend__writepack_commit
(
struct
git_odb_writepack
*
_writepack
,
git_
transf
er_progress
*
stats
)
static
int
pack_backend__writepack_commit
(
struct
git_odb_writepack
*
_writepack
,
git_
index
er_progress
*
stats
)
{
struct
pack_writepack
*
writepack
=
(
struct
pack_writepack
*
)
_writepack
;
...
...
@@ -516,7 +516,7 @@ static void pack_backend__writepack_free(struct git_odb_writepack *_writepack)
static
int
pack_backend__writepack
(
struct
git_odb_writepack
**
out
,
git_odb_backend
*
_backend
,
git_odb
*
odb
,
git_
transf
er_progress_cb
progress_cb
,
git_
index
er_progress_cb
progress_cb
,
void
*
progress_payload
)
{
git_indexer_options
opts
=
GIT_INDEXER_OPTIONS_INIT
;
...
...
src/pack-objects.c
View file @
5a6a3c00
...
...
@@ -38,7 +38,7 @@ struct tree_walk_context {
struct
pack_write_context
{
git_indexer
*
indexer
;
git_
transf
er_progress
*
stats
;
git_
index
er_progress
*
stats
;
};
struct
walk_object
{
...
...
@@ -1379,12 +1379,12 @@ int git_packbuilder_write(
git_packbuilder
*
pb
,
const
char
*
path
,
unsigned
int
mode
,
git_
transf
er_progress_cb
progress_cb
,
git_
index
er_progress_cb
progress_cb
,
void
*
progress_cb_payload
)
{
git_indexer_options
opts
=
GIT_INDEXER_OPTIONS_INIT
;
git_indexer
*
indexer
;
git_
transf
er_progress
stats
;
git_
index
er_progress
stats
;
struct
pack_write_context
ctx
;
int
t
;
...
...
src/remote.c
View file @
5a6a3c00
...
...
@@ -1770,7 +1770,7 @@ int git_remote_list(git_strarray *remotes_list, git_repository *repo)
return
0
;
}
const
git_
transfer_progress
*
git_remote_stats
(
git_remote
*
remote
)
const
git_
indexer_progress
*
git_remote_stats
(
git_remote
*
remote
)
{
assert
(
remote
);
return
&
remote
->
stats
;
...
...
src/remote.h
View file @
5a6a3c00
...
...
@@ -29,7 +29,7 @@ struct git_remote {
git_transport
*
transport
;
git_repository
*
repo
;
git_push
*
push
;
git_
transf
er_progress
stats
;
git_
index
er_progress
stats
;
unsigned
int
need_pack
;
git_remote_autotag_option_t
download_tags
;
int
prune_refs
;
...
...
src/transports/local.c
View file @
5a6a3c00
...
...
@@ -325,7 +325,7 @@ static int local_push_update_remote_ref(
return
error
;
}
static
int
transfer_to_push_transfer
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
transfer_to_push_transfer
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
const
git_remote_callbacks
*
cbs
=
payload
;
...
...
@@ -460,8 +460,8 @@ on_error:
}
typedef
struct
foreach_data
{
git_
transf
er_progress
*
stats
;
git_
transf
er_progress_cb
progress_cb
;
git_
index
er_progress
*
stats
;
git_
index
er_progress_cb
progress_cb
;
void
*
progress_payload
;
git_odb_writepack
*
writepack
;
}
foreach_data
;
...
...
@@ -533,8 +533,8 @@ static int foreach_reference_cb(git_reference *reference, void *payload)
static
int
local_download_pack
(
git_transport
*
transport
,
git_repository
*
repo
,
git_
transf
er_progress
*
stats
,
git_
transf
er_progress_cb
progress_cb
,
git_
index
er_progress
*
stats
,
git_
index
er_progress_cb
progress_cb
,
void
*
progress_payload
)
{
transport_local
*
t
=
(
transport_local
*
)
transport
;
...
...
src/transports/smart.h
View file @
5a6a3c00
...
...
@@ -177,8 +177,8 @@ int git_smart__negotiate_fetch(
int
git_smart__download_pack
(
git_transport
*
transport
,
git_repository
*
repo
,
git_
transf
er_progress
*
stats
,
git_
transf
er_progress_cb
progress_cb
,
git_
index
er_progress
*
stats
,
git_
index
er_progress_cb
progress_cb
,
void
*
progress_payload
);
/* smart.c */
...
...
src/transports/smart_protocol.c
View file @
5a6a3c00
...
...
@@ -492,7 +492,7 @@ on_error:
return
error
;
}
static
int
no_sideband
(
transport_smart
*
t
,
struct
git_odb_writepack
*
writepack
,
gitno_buffer
*
buf
,
git_
transf
er_progress
*
stats
)
static
int
no_sideband
(
transport_smart
*
t
,
struct
git_odb_writepack
*
writepack
,
gitno_buffer
*
buf
,
git_
index
er_progress
*
stats
)
{
int
recvd
;
...
...
@@ -519,9 +519,9 @@ static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack,
struct
network_packetsize_payload
{
git_
transf
er_progress_cb
callback
;
git_
index
er_progress_cb
callback
;
void
*
payload
;
git_
transf
er_progress
*
stats
;
git_
index
er_progress
*
stats
;
size_t
last_fired_bytes
;
};
...
...
@@ -546,8 +546,8 @@ static int network_packetsize(size_t received, void *payload)
int
git_smart__download_pack
(
git_transport
*
transport
,
git_repository
*
repo
,
git_
transf
er_progress
*
stats
,
git_
transfer_progress_cb
transfer_
progress_cb
,
git_
index
er_progress
*
stats
,
git_
indexer_progress_cb
progress_cb
,
void
*
progress_payload
)
{
transport_smart
*
t
=
(
transport_smart
*
)
transport
;
...
...
@@ -557,10 +557,10 @@ int git_smart__download_pack(
int
error
=
0
;
struct
network_packetsize_payload
npp
=
{
0
};
memset
(
stats
,
0
,
sizeof
(
git_
transf
er_progress
));
memset
(
stats
,
0
,
sizeof
(
git_
index
er_progress
));
if
(
transfer_
progress_cb
)
{
npp
.
callback
=
transfer_
progress_cb
;
if
(
progress_cb
)
{
npp
.
callback
=
progress_cb
;
npp
.
payload
=
progress_payload
;
npp
.
stats
=
stats
;
t
->
packetsize_cb
=
&
network_packetsize
;
...
...
@@ -573,7 +573,7 @@ int git_smart__download_pack(
}
if
((
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
))
<
0
||
((
error
=
git_odb_write_pack
(
&
writepack
,
odb
,
transfer_
progress_cb
,
progress_payload
))
!=
0
))
((
error
=
git_odb_write_pack
(
&
writepack
,
odb
,
progress_cb
,
progress_payload
))
!=
0
))
goto
done
;
/*
...
...
@@ -626,7 +626,7 @@ int git_smart__download_pack(
}
while
(
1
);
/*
* Trailing execution of
transfer_
progress_cb, if necessary...
* Trailing execution of progress_cb, if necessary...
* Only the callback through the npp datastructure currently
* updates the last_fired_bytes value. It is possible that
* progress has already been reported with the correct
...
...
@@ -645,7 +645,7 @@ int git_smart__download_pack(
done:
if
(
writepack
)
writepack
->
free
(
writepack
);
if
(
transfer_
progress_cb
)
{
if
(
progress_cb
)
{
t
->
packetsize_cb
=
NULL
;
t
->
packetsize_payload
=
NULL
;
}
...
...
@@ -978,7 +978,7 @@ struct push_packbuilder_payload
{
git_smart_subtransport_stream
*
stream
;
git_packbuilder
*
pb
;
git_push_transfer_progress
cb
;
git_push_transfer_progress
_cb
cb
;
void
*
cb_payload
;
size_t
last_bytes
;
double
last_progress_report_time
;
...
...
tests/clone/nonetwork.c
View file @
5a6a3c00
...
...
@@ -171,7 +171,7 @@ void test_clone_nonetwork__can_checkout_given_branch(void)
}
static
int
clone_cancel_fetch_transfer_progress_cb
(
const
git_
transf
er_progress
*
stats
,
void
*
data
)
const
git_
index
er_progress
*
stats
,
void
*
data
)
{
GIT_UNUSED
(
stats
);
GIT_UNUSED
(
data
);
return
-
54321
;
...
...
tests/network/fetchlocal.c
View file @
5a6a3c00
...
...
@@ -8,7 +8,7 @@ static const char* tagger_name = "Vicent Marti";
static
const
char
*
tagger_email
=
"vicent@github.com"
;
static
const
char
*
tagger_message
=
"This is my tag.
\n\n
There are many tags, but this one is mine
\n
"
;
static
int
transfer_cb
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
transfer_cb
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
int
*
callcount
=
(
int
*
)
payload
;
GIT_UNUSED
(
stats
);
...
...
tests/online/clone.c
View file @
5a6a3c00
...
...
@@ -158,7 +158,7 @@ static void checkout_progress(const char *path, size_t cur, size_t tot, void *pa
(
*
was_called
)
=
true
;
}
static
int
fetch_progress
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
fetch_progress
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
bool
*
was_called
=
(
bool
*
)
payload
;
GIT_UNUSED
(
stats
);
...
...
@@ -442,7 +442,7 @@ void test_online_clone__bitbucket_falls_back_to_specified_creds(void)
cl_fixture_cleanup
(
"./foo"
);
}
static
int
cancel_at_half
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
cancel_at_half
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
GIT_UNUSED
(
payload
);
...
...
tests/online/fetch.c
View file @
5a6a3c00
...
...
@@ -25,7 +25,7 @@ static int update_tips(const char *refname, const git_oid *a, const git_oid *b,
return
0
;
}
static
int
progress
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
progress
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
size_t
*
bytes_received
=
(
size_t
*
)
payload
;
*
bytes_received
=
stats
->
received_bytes
;
...
...
@@ -92,7 +92,7 @@ void test_online_fetch__fetch_twice(void)
git_remote_free
(
remote
);
}
static
int
transferProgressCallback
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
transferProgressCallback
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
bool
*
invoked
=
(
bool
*
)
payload
;
...
...
@@ -134,7 +134,7 @@ void test_online_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date
git_repository_free
(
_repository
);
}
static
int
cancel_at_half
(
const
git_
transf
er_progress
*
stats
,
void
*
payload
)
static
int
cancel_at_half
(
const
git_
index
er_progress
*
stats
,
void
*
payload
)
{
GIT_UNUSED
(
payload
);
...
...
tests/pack/indexer.c
View file @
5a6a3c00
...
...
@@ -98,7 +98,7 @@ static const unsigned int base_obj_len = 2;
void
test_pack_indexer__out_of_order
(
void
)
{
git_indexer
*
idx
=
0
;
git_
transf
er_progress
stats
=
{
0
};
git_
index
er_progress
stats
=
{
0
};
cl_git_pass
(
git_indexer_new
(
&
idx
,
"."
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_indexer_append
(
...
...
@@ -115,7 +115,7 @@ void test_pack_indexer__out_of_order(void)
void
test_pack_indexer__missing_trailer
(
void
)
{
git_indexer
*
idx
=
0
;
git_
transf
er_progress
stats
=
{
0
};
git_
index
er_progress
stats
=
{
0
};
cl_git_pass
(
git_indexer_new
(
&
idx
,
"."
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_indexer_append
(
...
...
@@ -131,7 +131,7 @@ void test_pack_indexer__missing_trailer(void)
void
test_pack_indexer__leaky
(
void
)
{
git_indexer
*
idx
=
0
;
git_
transf
er_progress
stats
=
{
0
};
git_
index
er_progress
stats
=
{
0
};
cl_git_pass
(
git_indexer_new
(
&
idx
,
"."
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_indexer_append
(
...
...
@@ -147,7 +147,7 @@ void test_pack_indexer__leaky(void)
void
test_pack_indexer__fix_thin
(
void
)
{
git_indexer
*
idx
=
NULL
;
git_
transf
er_progress
stats
=
{
0
};
git_
index
er_progress
stats
=
{
0
};
git_repository
*
repo
;
git_odb
*
odb
;
git_oid
id
,
should_id
;
...
...
@@ -213,7 +213,7 @@ void test_pack_indexer__fix_thin(void)
void
test_pack_indexer__corrupt_length
(
void
)
{
git_indexer
*
idx
=
NULL
;
git_
transf
er_progress
stats
=
{
0
};
git_
index
er_progress
stats
=
{
0
};
git_repository
*
repo
;
git_odb
*
odb
;
git_oid
id
,
should_id
;
...
...
@@ -243,7 +243,7 @@ void test_pack_indexer__incomplete_pack_fails_with_strict(void)
{
git_indexer_options
opts
=
GIT_INDEXER_OPTIONS_INIT
;
git_indexer
*
idx
=
0
;
git_
transf
er_progress
stats
=
{
0
};
git_
index
er_progress
stats
=
{
0
};
opts
.
verify
=
1
;
...
...
@@ -263,7 +263,7 @@ void test_pack_indexer__out_of_order_with_connectivity_checks(void)
{
git_indexer_options
opts
=
GIT_INDEXER_OPTIONS_INIT
;
git_indexer
*
idx
=
0
;
git_
transf
er_progress
stats
=
{
0
};
git_
index
er_progress
stats
=
{
0
};
opts
.
verify
=
1
;
...
...
tests/pack/packbuilder.c
View file @
5a6a3c00
...
...
@@ -12,7 +12,7 @@ static git_packbuilder *_packbuilder;
static
git_indexer
*
_indexer
;
static
git_vector
_commits
;
static
int
_commits_is_initialized
;
static
git_
transf
er_progress
_stats
;
static
git_
index
er_progress
_stats
;
extern
bool
git_disable_pack_keep_file_checks
;
...
...
@@ -88,14 +88,14 @@ static void seed_packbuilder(void)
static
int
feed_indexer
(
void
*
ptr
,
size_t
len
,
void
*
payload
)
{
git_
transfer_progress
*
stats
=
(
git_transf
er_progress
*
)
payload
;
git_
indexer_progress
*
stats
=
(
git_index
er_progress
*
)
payload
;
return
git_indexer_append
(
_indexer
,
ptr
,
len
,
stats
);
}
void
test_pack_packbuilder__create_pack
(
void
)
{
git_
transf
er_progress
stats
;
git_
index
er_progress
stats
;
git_buf
buf
=
GIT_BUF_INIT
,
path
=
GIT_BUF_INIT
;
git_hash_ctx
ctx
;
git_oid
hash
;
...
...
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