Skip to content

Commit f88fcf8

Browse files
iabervonJunio C Hamano
authored andcommitted
[PATCH] Fix parallel pull dependancy tracking.
It didn't refetch an object it already had (good), but didn't process it, either (bad). Synchronously process anything you already have. Signed-off-by: Daniel Barkalow <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a6bc313 commit f88fcf8

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

pull.c

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,38 @@ static int process_tag(struct tag *tag)
9898
static struct object_list *process_queue = NULL;
9999
static struct object_list **process_queue_end = &process_queue;
100100

101-
static int process(unsigned char *sha1, const char *type)
101+
static int process_object(struct object *obj)
102102
{
103-
struct object *obj;
104-
if (has_sha1_file(sha1))
103+
if (obj->type == commit_type) {
104+
if (process_commit((struct commit *)obj))
105+
return -1;
106+
return 0;
107+
}
108+
if (obj->type == tree_type) {
109+
if (process_tree((struct tree *)obj))
110+
return -1;
111+
return 0;
112+
}
113+
if (obj->type == blob_type) {
114+
return 0;
115+
}
116+
if (obj->type == tag_type) {
117+
if (process_tag((struct tag *)obj))
118+
return -1;
105119
return 0;
106-
obj = lookup_object_type(sha1, type);
120+
}
121+
return error("Unable to determine requirements "
122+
"of type %s for %s",
123+
obj->type, sha1_to_hex(obj->sha1));
124+
}
125+
126+
static int process(unsigned char *sha1, const char *type)
127+
{
128+
struct object *obj = lookup_object_type(sha1, type);
129+
if (has_sha1_file(sha1)) {
130+
/* We already have it, so we should scan it now. */
131+
return process_object(obj);
132+
}
107133
if (object_list_contains(process_queue, obj))
108134
return 0;
109135
object_list_insert(obj, process_queue_end);
@@ -134,27 +160,8 @@ static int loop(void)
134160
return -1;
135161
if (!obj->type)
136162
parse_object(obj->sha1);
137-
if (obj->type == commit_type) {
138-
if (process_commit((struct commit *)obj))
139-
return -1;
140-
continue;
141-
}
142-
if (obj->type == tree_type) {
143-
if (process_tree((struct tree *)obj))
144-
return -1;
145-
continue;
146-
}
147-
if (obj->type == blob_type) {
148-
continue;
149-
}
150-
if (obj->type == tag_type) {
151-
if (process_tag((struct tag *)obj))
152-
return -1;
153-
continue;
154-
}
155-
return error("Unable to determine requirements "
156-
"of type %s for %s",
157-
obj->type, sha1_to_hex(obj->sha1));
163+
if (process_object(obj))
164+
return -1;
158165
}
159166
return 0;
160167
}

0 commit comments

Comments
 (0)