@matheusbsbs / matheus-bagliano / commits / 420e9af498
Fork 0

Fix tag following

Before the second fetch-pack connection in the same process, unmark all of the objects marked in the first connection, in order that we'll list them as things we have instead of thinking we've already mentioned them. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Daniel Barkalow committed Mar 17, 2008 at 22:15 UTC 420e9af498848f9a3994ecb471dc51d5203f51cd
1 file changed +16
builtin-fetch-pack.c
+16
@@ -26,6 +26,8 @@ static const char fetch_pack_usage[] =
26 #define SEEN (1U << 3)
27 #define POPPED (1U << 4)
28
29 +static int marked;
30 +
31 /*
32 * After sending this many "have"s if we do not get any new ACK , we
33 * give up traversing our history.
@@ -61,6 +63,16 @@ static int rev_list_insert_ref(const char *path, const unsigned char *sha1, int
63 return 0;
64 }
65
66 +static int clear_marks(const char *path, const unsigned char *sha1, int flag, void *cb_data)
67 +{
68 + struct object *o = deref_tag(parse_object(sha1), path, 0);
69 +
70 + if (o && o->type == OBJ_COMMIT)
71 + clear_commit_marks((struct commit *)o,
72 + COMMON | COMMON_REF | SEEN | POPPED);
73 + return 0;
74 +}
75 +
76 /*
77 This function marks a rev and its ancestors as common.
78 In some cases, it is desirable to mark only the ancestors (for example
@@ -153,6 +165,10 @@ static int find_common(int fd[2], unsigned char *result_sha1,
165 unsigned in_vain = 0;
166 int got_continue = 0;
167
168 + if (marked)
169 + for_each_ref(clear_marks, NULL);
170 + marked = 1;
171 +
172 for_each_ref(rev_list_insert_ref, NULL);
173
174 fetching = 0;