summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2005-08-11 23:38:09 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-08-12 01:59:19 (GMT)
commitf88fcf8bab6a3dcd1255bc64f50235c745458962 (patch)
treeb4abb605d452bda61bee371f6b83002867ace83e
parenta6bc31338ee99b1ade13b260c96800ea826bb9d1 (diff)
downloadgit-f88fcf8bab6a3dcd1255bc64f50235c745458962.zip
git-f88fcf8bab6a3dcd1255bc64f50235c745458962.tar.gz
git-f88fcf8bab6a3dcd1255bc64f50235c745458962.tar.bz2
[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 <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--pull.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/pull.c b/pull.c
index 950d9f4..cf3ec73 100644
--- a/pull.c
+++ b/pull.c
@@ -98,12 +98,38 @@ static int process_tag(struct tag *tag)
static struct object_list *process_queue = NULL;
static struct object_list **process_queue_end = &process_queue;
-static int process(unsigned char *sha1, const char *type)
+static int process_object(struct object *obj)
{
- struct object *obj;
- if (has_sha1_file(sha1))
+ if (obj->type == commit_type) {
+ if (process_commit((struct commit *)obj))
+ return -1;
+ return 0;
+ }
+ if (obj->type == tree_type) {
+ if (process_tree((struct tree *)obj))
+ return -1;
+ return 0;
+ }
+ if (obj->type == blob_type) {
+ return 0;
+ }
+ if (obj->type == tag_type) {
+ if (process_tag((struct tag *)obj))
+ return -1;
return 0;
- obj = lookup_object_type(sha1, type);
+ }
+ return error("Unable to determine requirements "
+ "of type %s for %s",
+ obj->type, sha1_to_hex(obj->sha1));
+}
+
+static int process(unsigned char *sha1, const char *type)
+{
+ struct object *obj = lookup_object_type(sha1, type);
+ if (has_sha1_file(sha1)) {
+ /* We already have it, so we should scan it now. */
+ return process_object(obj);
+ }
if (object_list_contains(process_queue, obj))
return 0;
object_list_insert(obj, process_queue_end);
@@ -134,27 +160,8 @@ static int loop(void)
return -1;
if (!obj->type)
parse_object(obj->sha1);
- if (obj->type == commit_type) {
- if (process_commit((struct commit *)obj))
- return -1;
- continue;
- }
- if (obj->type == tree_type) {
- if (process_tree((struct tree *)obj))
- return -1;
- continue;
- }
- if (obj->type == blob_type) {
- continue;
- }
- if (obj->type == tag_type) {
- if (process_tag((struct tag *)obj))
- return -1;
- continue;
- }
- return error("Unable to determine requirements "
- "of type %s for %s",
- obj->type, sha1_to_hex(obj->sha1));
+ if (process_object(obj))
+ return -1;
}
return 0;
}