summaryrefslogtreecommitdiff
path: root/local-fetch.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2005-10-29 13:02:18 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2005-10-29 13:02:18 -0700
commit0ffdbbfe36a25682cbb2e6b18b9217c93c97b424 (patch)
tree608a7d756ae586e9c40c88d73f9f1bd98f81f2e8 /local-fetch.c
parentFix recent documentation format breakage. (diff)
downloadtgif-0ffdbbfe36a25682cbb2e6b18b9217c93c97b424.tar.xz
Teach local-fetch about lazy object directories.
The latest init-db does not create .git/objects/??/ directories anymore and expects the users of the repository to create them as they are needed. local-fetch was not taught about it, which broke local cloning with Cogito. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'local-fetch.c')
-rw-r--r--local-fetch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/local-fetch.c b/local-fetch.c
index 87a93de02f..0a071144b5 100644
--- a/local-fetch.c
+++ b/local-fetch.c
@@ -52,9 +52,10 @@ static int setup_indices(void)
return 0;
}
-static int copy_file(const char *source, const char *dest, const char *hex,
+static int copy_file(const char *source, char *dest, const char *hex,
int warn_if_not_exists)
{
+ safe_create_leading_directories(dest);
if (use_link) {
if (!link(source, dest)) {
pull_say("link %s\n", hex);
@@ -150,7 +151,7 @@ static int fetch_file(const unsigned char *sha1)
static int object_name_start = -1;
static char filename[PATH_MAX];
char *hex = sha1_to_hex(sha1);
- const char *dest_filename = sha1_file_name(sha1);
+ char *dest_filename = sha1_file_name(sha1);
if (object_name_start < 0) {
strcpy(filename, path); /* e.g. git.git */