From: Junio C Hamano Date: Sun, 25 May 2008 20:38:44 +0000 (-0700) Subject: Merge branch 'db/clone-in-c' X-Git-Tag: v1.5.6-rc0~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b84c343c885b8168047b2773b5c597d04337d9bd;p=git.git Merge branch 'db/clone-in-c' * 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 --- b84c343c885b8168047b2773b5c597d04337d9bd diff --cc builtin-init-db.c index b06131727,5650685e4..3968c9911 --- a/builtin-init-db.c +++ b/builtin-init-db.c @@@ -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 ef330b4c6,f3ad9741c..3d4e8e77d --- a/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" diff --cc remote.c index 9e4f2b84d,9cb40afd0..75a12c076 --- a/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 index c2f557357,f0a79de21..8eed87ba5 --- a/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 t/t5700-clone-reference.sh index e5619a9f5,0112c218e..e1ca7303a --- a/t/t5700-clone-reference.sh +++ b/t/t5700-clone-reference.sh @@@ -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"