From: Junio C Hamano <gitster@pobox.com>
Date: Wed, 25 Jun 2008 20:18:54 +0000 (-0700)
Subject: Merge branch 'jh/clone-packed-refs'
X-Git-Tag: v1.6.0-rc0~211
X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/01d8ff70f40d8be3c4e2efb245ffc3d013b7fcbf?hp=-c

Merge branch 'jh/clone-packed-refs'

* 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
---

01d8ff70f40d8be3c4e2efb245ffc3d013b7fcbf
diff --combined Makefile
index 314339d7e0,adbe44213a..3584b8ccdf
--- a/Makefile
+++ 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 b2dfe1ab5c,5c5acb4bb1..f13845fb7f
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@@ -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);
@@@ -413,8 -414,6 +417,8 @@@
  
  	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);