upload-pack: move oldest_have to upload_pack_data
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'oldest_have' static variable into this struct. It is used by both protocol v0 and protocol v2 code. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
460ed0d4b4
commit
f01c7916b8
@ -42,8 +42,6 @@
|
|||||||
#define ALL_FLAGS (THEY_HAVE | OUR_REF | WANTED | COMMON_KNOWN | SHALLOW | \
|
#define ALL_FLAGS (THEY_HAVE | OUR_REF | WANTED | COMMON_KNOWN | SHALLOW | \
|
||||||
NOT_SHALLOW | CLIENT_SHALLOW | HIDDEN_REF)
|
NOT_SHALLOW | CLIENT_SHALLOW | HIDDEN_REF)
|
||||||
|
|
||||||
static timestamp_t oldest_have;
|
|
||||||
|
|
||||||
/* Enum for allowed unadvertised object request (UOR) */
|
/* Enum for allowed unadvertised object request (UOR) */
|
||||||
enum allow_uor {
|
enum allow_uor {
|
||||||
/* Allow specifying sha1 if it is a ref tip. */
|
/* Allow specifying sha1 if it is a ref tip. */
|
||||||
@ -74,6 +72,7 @@ struct upload_pack_data {
|
|||||||
int deepen_relative;
|
int deepen_relative;
|
||||||
int keepalive;
|
int keepalive;
|
||||||
int shallow_nr;
|
int shallow_nr;
|
||||||
|
timestamp_t oldest_have;
|
||||||
|
|
||||||
unsigned int timeout; /* v0 only */
|
unsigned int timeout; /* v0 only */
|
||||||
enum {
|
enum {
|
||||||
@ -414,8 +413,8 @@ static int got_oid(struct upload_pack_data *data,
|
|||||||
we_knew_they_have = 1;
|
we_knew_they_have = 1;
|
||||||
else
|
else
|
||||||
o->flags |= THEY_HAVE;
|
o->flags |= THEY_HAVE;
|
||||||
if (!oldest_have || (commit->date < oldest_have))
|
if (!data->oldest_have || (commit->date < data->oldest_have))
|
||||||
oldest_have = commit->date;
|
data->oldest_have = commit->date;
|
||||||
for (parents = commit->parents;
|
for (parents = commit->parents;
|
||||||
parents;
|
parents;
|
||||||
parents = parents->next)
|
parents = parents->next)
|
||||||
@ -436,7 +435,7 @@ static int ok_to_give_up(struct upload_pack_data *data)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return can_all_from_reach_with_flag(&data->want_obj, THEY_HAVE,
|
return can_all_from_reach_with_flag(&data->want_obj, THEY_HAVE,
|
||||||
COMMON_KNOWN, oldest_have,
|
COMMON_KNOWN, data->oldest_have,
|
||||||
min_generation);
|
min_generation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1372,8 +1371,8 @@ static int process_haves(struct upload_pack_data *data, struct oid_array *common
|
|||||||
we_knew_they_have = 1;
|
we_knew_they_have = 1;
|
||||||
else
|
else
|
||||||
o->flags |= THEY_HAVE;
|
o->flags |= THEY_HAVE;
|
||||||
if (!oldest_have || (commit->date < oldest_have))
|
if (!data->oldest_have || (commit->date < data->oldest_have))
|
||||||
oldest_have = commit->date;
|
data->oldest_have = commit->date;
|
||||||
for (parents = commit->parents;
|
for (parents = commit->parents;
|
||||||
parents;
|
parents;
|
||||||
parents = parents->next)
|
parents = parents->next)
|
||||||
|
Reference in New Issue
Block a user