Skip to content

Commit f01c791

Browse files
chriscoolgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 460ed0d commit f01c791

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

upload-pack.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
#define ALL_FLAGS (THEY_HAVE | OUR_REF | WANTED | COMMON_KNOWN | SHALLOW | \
4343
NOT_SHALLOW | CLIENT_SHALLOW | HIDDEN_REF)
4444

45-
static timestamp_t oldest_have;
46-
4745
/* Enum for allowed unadvertised object request (UOR) */
4846
enum allow_uor {
4947
/* Allow specifying sha1 if it is a ref tip. */
@@ -74,6 +72,7 @@ struct upload_pack_data {
7472
int deepen_relative;
7573
int keepalive;
7674
int shallow_nr;
75+
timestamp_t oldest_have;
7776

7877
unsigned int timeout; /* v0 only */
7978
enum {
@@ -414,8 +413,8 @@ static int got_oid(struct upload_pack_data *data,
414413
we_knew_they_have = 1;
415414
else
416415
o->flags |= THEY_HAVE;
417-
if (!oldest_have || (commit->date < oldest_have))
418-
oldest_have = commit->date;
416+
if (!data->oldest_have || (commit->date < data->oldest_have))
417+
data->oldest_have = commit->date;
419418
for (parents = commit->parents;
420419
parents;
421420
parents = parents->next)
@@ -436,7 +435,7 @@ static int ok_to_give_up(struct upload_pack_data *data)
436435
return 0;
437436

438437
return can_all_from_reach_with_flag(&data->want_obj, THEY_HAVE,
439-
COMMON_KNOWN, oldest_have,
438+
COMMON_KNOWN, data->oldest_have,
440439
min_generation);
441440
}
442441

@@ -1372,8 +1371,8 @@ static int process_haves(struct upload_pack_data *data, struct oid_array *common
13721371
we_knew_they_have = 1;
13731372
else
13741373
o->flags |= THEY_HAVE;
1375-
if (!oldest_have || (commit->date < oldest_have))
1376-
oldest_have = commit->date;
1374+
if (!data->oldest_have || (commit->date < data->oldest_have))
1375+
data->oldest_have = commit->date;
13771376
for (parents = commit->parents;
13781377
parents;
13791378
parents = parents->next)

0 commit comments

Comments
 (0)