OSDN Git Service

Merge branch 'db/clone-in-c'
authorJunio C Hamano <gitster@pobox.com>
Sun, 25 May 2008 20:38:44 +0000 (13:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 25 May 2008 20:41:37 +0000 (13:41 -0700)
* db/clone-in-c:
  Add test for cloning with "--reference" repo being a subset of source repo
  Add a test for another combination of --reference
  Test that --reference actually suppresses fetching referenced objects
  clone: fall back to copying if hardlinking fails
  builtin-clone.c: Need to closedir() in copy_or_link_directory()
  builtin-clone: fix initial checkout
  Build in clone
  Provide API access to init_db()
  Add a function to set a non-default work tree
  Allow for having for_each_ref() list extra refs
  Have a constant extern refspec for "--tags"
  Add a library function to add an alternate to the alternates file
  Add a lockfile function to append to a file
  Mark the list of refs to fetch as const

Conflicts:

cache.h
t/t5700-clone-reference.sh

13 files changed:
1  2 
Makefile
builtin-fetch.c
builtin-init-db.c
cache.h
contrib/examples/git-clone.sh
environment.c
lockfile.c
refs.c
remote.c
remote.h
sha1_file.c
t/t5700-clone-reference.sh
transport.c

diff --cc Makefile
Simple merge
diff --cc builtin-fetch.c
Simple merge
@@@ -251,12 -248,14 +248,14 @@@ static int create_default_files(const c
                /* allow template config file to override the default */
                if (log_all_ref_updates == -1)
                    git_config_set("core.logallrefupdates", "true");
-               if (work_tree != git_work_tree_cfg)
+               if (prefixcmp(git_dir, work_tree) ||
+                   strcmp(git_dir + strlen(work_tree), "/.git")) {
                        git_config_set("core.worktree", work_tree);
+               }
        }
  
 -      /* Check if symlink is supported in the work tree */
        if (!reinit) {
 +              /* Check if symlink is supported in the work tree */
                path[len] = 0;
                strcpy(path + len, "tXXXXXX");
                if (!close(xmkstemp(path)) &&
diff --cc cache.h
+++ b/cache.h
@@@ -316,7 -311,7 +316,8 @@@ extern char *get_index_file(void)
  extern char *get_graft_file(void);
  extern int set_git_dir(const char *path);
  extern const char *get_git_work_tree(void);
 +extern const char *read_gitfile_gently(const char *path);
+ extern void set_git_work_tree(const char *tree);
  
  #define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
  
Simple merge
diff --cc environment.c
Simple merge
diff --cc lockfile.c
Simple merge
diff --cc refs.c
Simple merge
diff --cc remote.c
+++ b/remote.c
@@@ -2,6 -2,15 +2,16 @@@
  #include "remote.h"
  #include "refs.h"
  
+ static struct refspec s_tag_refspec = {
+       0,
+       1,
++      0,
+       "refs/tags/",
+       "refs/tags/"
+ };
+ const struct refspec *tag_refspec = &s_tag_refspec;
  struct counted_string {
        size_t len;
        const char *s;
diff --cc remote.h
+++ b/remote.h
@@@ -53,10 -51,10 +53,12 @@@ struct refspec 
        char *dst;
  };
  
+ extern const struct refspec *tag_refspec;
  struct ref *alloc_ref(unsigned namelen);
  
 +struct ref *alloc_ref_from_str(const char* str);
 +
  struct ref *copy_ref_list(const struct ref *ref);
  
  int check_ref_type(const struct ref *ref, int flags);
diff --cc sha1_file.c
Simple merge
@@@ -50,8 -52,13 +52,13 @@@ diff expected current
  
  cd "$base_dir"
  
+ rm -f $U
  test_expect_success 'cloning with reference (no -l -s)' \
- 'git clone --reference B "file://$(pwd)/A" D'
 -'GIT_DEBUG_SEND_PACK=3 git clone --reference B file://`pwd`/A D 3>$U'
++'GIT_DEBUG_SEND_PACK=3 git clone --reference B "file://$(pwd)/A" D 3>$U'
+ test_expect_success 'fetched no objects' \
+ '! grep "^want" $U'
  
  cd "$base_dir"
  
diff --cc transport.c
Simple merge