]> rtime.felk.cvut.cz Git - git.git/commitdiff
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
index b061317275792ccb33eea80a5071b72ed6f8d6a7,5650685e4ecb0f7a9352f95abe6bd7ef3d4c82d6..3968c9911ff23717a4505ba9a02af6e27bf0b4a0
@@@ -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
index ef330b4c6b71ebf5775b9fbb889ea635c7422c30,f3ad9741cc3e57104b2cdc38de16012f13b241d1..3d4e8e77d8d47f1861af6488aacb1e8a9a57ac8f
+++ 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
index 9e4f2b84d90cb97a6cb19779325f9ea443a76e43,9cb40afd0e3a4a35d9811ba48c5b08a0b39cf565..75a12c0762160dd877d0b6f63f8ec47228b7fee4
+++ 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
index c2f557357fd4a0eb247f0e6f688efd10f946a08a,f0a79de210ce34c62781ebb7e0aa8a66390226b7..8eed87ba5ab78eb4635632c21843590467d0d864
+++ 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
index e5619a9f5c9aae8c9565dd6937c20ce6401d26d4,0112c218e0ebcd67fede154f59a82a1a5b6a4aec..e1ca7303ac83a79eb4668c8f828e068c1220e72d
@@@ -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