Merge branch 'jh/clone-packed-refs'
authorJunio C Hamano <gitster@pobox.com>
Wed, 25 Jun 2008 20:18:54 +0000 (13:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Jun 2008 20:18:54 +0000 (13:18 -0700)
* jh/clone-packed-refs:
Teach "git clone" to pack refs
Prepare testsuite for a "git clone" that packs refs
Move pack_refs() and friends into libgit
Incorporate fetched packs in future object traversal

1  2 
Makefile
builtin-clone.c
diff --combined Makefile
index 314339d7e0071ac3e7f761e9c70d1df0c12e7b8c,adbe44213a4aa9e12f3d998bd59f91ec70129226..3584b8ccdf030c62012f650a2d02127dc01d4a92
+++ b/Makefile
@@@ -354,6 -354,7 +354,7 @@@ LIB_H += log-tree.
  LIB_H += mailmap.h
  LIB_H += object.h
  LIB_H += pack.h
+ LIB_H += pack-refs.h
  LIB_H += pack-revindex.h
  LIB_H += parse-options.h
  LIB_H += patch-ids.h
@@@ -429,6 -430,7 +430,7 @@@ LIB_OBJS += merge-file.
  LIB_OBJS += name-hash.o
  LIB_OBJS += object.o
  LIB_OBJS += pack-check.o
+ LIB_OBJS += pack-refs.o
  LIB_OBJS += pack-revindex.o
  LIB_OBJS += pack-write.o
  LIB_OBJS += pager.o
@@@ -467,7 -469,6 +469,7 @@@ LIB_OBJS += unpack-trees.
  LIB_OBJS += usage.o
  LIB_OBJS += utf8.o
  LIB_OBJS += walker.o
 +LIB_OBJS += wrapper.o
  LIB_OBJS += write_or_die.o
  LIB_OBJS += ws.o
  LIB_OBJS += wt-status.o
@@@ -1291,9 -1292,6 +1293,9 @@@ endi
  install-doc:
        $(MAKE) -C Documentation install
  
 +install-html:
 +      $(MAKE) -C Documentation install-html
 +
  install-info:
        $(MAKE) -C Documentation install-info
  
diff --combined builtin-clone.c
index b2dfe1ab5c6df0da0af0004bdf5accd6d37a90d8,5c5acb4bb14377f07a9d6c1a1705efeecf5bab0c..f13845fb7f0c4b3759a3055fdfe216f83d18f957
@@@ -18,6 -18,7 +18,7 @@@
  #include "transport.h"
  #include "strbuf.h"
  #include "dir.h"
+ #include "pack-refs.h"
  
  /*
   * Overall FIXMEs:
@@@ -321,8 -322,11 +322,11 @@@ static struct ref *write_remote_refs(co
        get_fetch_map(refs, tag_refspec, &tail, 0);
  
        for (r = local_refs; r; r = r->next)
-               update_ref(reflog,
-                          r->peer_ref->name, r->old_sha1, NULL, 0, DIE_ON_ERR);
+               add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
+       pack_refs(PACK_REFS_ALL);
+       clear_extra_refs();
        return local_refs;
  }
  
@@@ -400,9 -404,6 +404,9 @@@ int cmd_clone(int argc, const char **ar
  
        if (!option_bare) {
                junk_work_tree = work_tree;
 +              if (safe_create_leading_directories_const(work_tree) < 0)
 +                      die("could not create leading directories of '%s'",
 +                                      work_tree);
                if (mkdir(work_tree, 0755))
                        die("could not create work tree dir '%s'.", work_tree);
                set_git_work_tree(work_tree);
  
        setenv(CONFIG_ENVIRONMENT, xstrdup(mkpath("%s/config", git_dir)), 1);
  
 +      if (safe_create_leading_directories_const(git_dir) < 0)
 +              die("could not create leading directories of '%s'", git_dir);
        set_git_dir(make_absolute_path(git_dir));
  
        fprintf(stderr, "Initialize %s\n", git_dir);