Code

Rework pretty_print_commit to use strbufs instead of custom buffers.
[git.git] / fetch.c
diff --git a/fetch.c b/fetch.c
index f69be82f10d287d71f6184c4b9203bdab3ce81fc..dd6ed9e41cf7ebbd304568f422da0b14a5e01d27 100644 (file)
--- a/fetch.c
+++ b/fetch.c
@@ -15,7 +15,7 @@ int get_verbosely = 0;
 int get_recover = 0;
 static unsigned char current_commit_sha1[20];
 
-void pull_say(const char *fmt, const char *hex) 
+void pull_say(const char *fmt, const char *hex)
 {
        if (get_verbosely)
                fprintf(stderr, fmt, hex);
@@ -42,11 +42,13 @@ static int process_tree(struct tree *tree)
        if (parse_tree(tree))
                return -1;
 
-       desc.buf = tree->buffer;
-       desc.size = tree->size;
+       init_tree_desc(&desc, tree->buffer, tree->size);
        while (tree_entry(&desc, &entry)) {
                struct object *obj = NULL;
 
+               /* submodule commits are not stored in the superproject */
+               if (S_ISGITLINK(entry.mode))
+                       continue;
                if (S_ISDIR(entry.mode)) {
                        struct tree *tree = lookup_tree(entry.sha1);
                        if (tree)
@@ -154,7 +156,7 @@ static int process(struct object *obj)
                        return 0;
                prefetch(obj->sha1);
        }
-               
+
        object_list_insert(obj, process_queue_end);
        process_queue_end = &(*process_queue_end)->next;
        return 0;
@@ -216,7 +218,7 @@ int pull_targets_stdin(char ***target, const char ***write_ref)
        int targets = 0, targets_alloc = 0;
        struct strbuf buf;
        *target = NULL; *write_ref = NULL;
-       strbuf_init(&buf);
+       strbuf_init(&buf, 0);
        while (1) {
                char *rf_one = NULL;
                char *tg_one;