Merge branch 'sp/fetch-optim'
authorJunio C Hamano <gitster@pobox.com>
Sun, 9 Mar 2008 04:11:35 +0000 (20:11 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 9 Mar 2008 04:11:35 +0000 (20:11 -0800)
* sp/fetch-optim:
Teach git-fetch to exploit server side automatic tag following
Teach fetch-pack/upload-pack about --include-tag
git-pack-objects: Automatically pack annotated tags if object was packed
Teach git-fetch to grab a tag at the same time as a commit
Make git-fetch follow tags we already have objects for sooner
Teach upload-pack to log the received need lines to an fd
Free the path_lists used to find non-local tags in git-fetch
Allow builtin-fetch's find_non_local_tags to append onto a list
Ensure tail pointer gets setup correctly when we fetch HEAD only
Remove unnecessary delaying of free_refs(ref_map) in builtin-fetch
Remove unused variable in builtin-fetch find_non_local_tags

1  2 
builtin-fetch-pack.c
diff --combined builtin-fetch-pack.c
index 29b38e4650cbd032ecfae02b334ce2b62ea1e622,34fb6d5c61e723278e70fe5949ed5a529904d958..7b280242244094774c909f67d6a8ed7902389c5a
@@@ -18,7 -18,7 +18,7 @@@ static struct fetch_pack_args args = 
  };
  
  static const char fetch_pack_usage[] =
- "git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
+ "git-fetch-pack [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] [--upload-pack=<git-upload-pack>] [--depth=<n>] [--no-progress] [-v] [<host>:]<directory> [<refs>...]";
  
  #define COMPLETE      (1U << 0)
  #define COMMON                (1U << 1)
@@@ -41,8 -41,7 +41,8 @@@ static void rev_list_push(struct commi
                commit->object.flags |= mark;
  
                if (!(commit->object.parsed))
 -                      parse_commit(commit);
 +                      if (parse_commit(commit))
 +                              return;
  
                insert_by_date(commit, &rev_list);
  
@@@ -84,8 -83,7 +84,8 @@@ static void mark_common(struct commit *
                        if (!ancestors_only && !(o->flags & POPPED))
                                non_common_revs--;
                        if (!o->parsed && !dont_parse)
 -                              parse_commit(commit);
 +                              if (parse_commit(commit))
 +                                      return;
  
                        for (parents = commit->parents;
                                        parents;
@@@ -105,20 -103,20 +105,20 @@@ static const unsigned char* get_rev(voi
  
        while (commit == NULL) {
                unsigned int mark;
 -              struct commit_list* parents;
 +              struct commit_list *parents = NULL;
  
                if (rev_list == NULL || non_common_revs == 0)
                        return NULL;
  
                commit = rev_list->item;
                if (!(commit->object.parsed))
 -                      parse_commit(commit);
 +                      if (!parse_commit(commit))
 +                              parents = commit->parents;
 +
                commit->object.flags |= POPPED;
                if (!(commit->object.flags & COMMON))
                        non_common_revs--;
  
 -              parents = commit->parents;
 -
                if (commit->object.flags & COMMON) {
                        /* do not send "have", and ignore ancestors */
                        commit = NULL;
@@@ -176,13 -174,14 +176,14 @@@ static int find_common(int fd[2], unsig
                }
  
                if (!fetching)
-                       packet_write(fd[1], "want %s%s%s%s%s%s%s\n",
+                       packet_write(fd[1], "want %s%s%s%s%s%s%s%s\n",
                                     sha1_to_hex(remote),
                                     (multi_ack ? " multi_ack" : ""),
                                     (use_sideband == 2 ? " side-band-64k" : ""),
                                     (use_sideband == 1 ? " side-band" : ""),
                                     (args.use_thin_pack ? " thin-pack" : ""),
                                     (args.no_progress ? " no-progress" : ""),
+                                    (args.include_tag ? " include-tag" : ""),
                                     " ofs-delta");
                else
                        packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
                                if (!lookup_object(sha1))
                                        die("object not found: %s", line);
                                /* make sure that it is parsed as shallow */
 -                              parse_object(sha1);
 +                              if (!parse_object(sha1))
 +                                      die("error in object: %s", line);
                                if (unregister_shallow(sha1))
                                        die("no shallow found: %s", line);
                                continue;
@@@ -683,6 -681,10 +684,10 @@@ int cmd_fetch_pack(int argc, const cha
                                args.use_thin_pack = 1;
                                continue;
                        }
+                       if (!strcmp("--include-tag", arg)) {
+                               args.include_tag = 1;
+                               continue;
+                       }
                        if (!strcmp("--all", arg)) {
                                args.fetch_all = 1;
                                continue;