@matheusbsbs / matheus-bagliano / commits / 0ffdbbfe36
Fork 0

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>

Junio C Hamano committed Oct 29, 2005 at 13:02 UTC 0ffdbbfe36a25682cbb2e6b18b9217c93c97b424
1 file changed +3 -2
local-fetch.c
+3 -2
@@ -52,9 +52,10 @@ static int setup_indices(void)
52 return 0;
53 }
54
55 -static int copy_file(const char *source, const char *dest, const char *hex,
55 +static int copy_file(const char *source, char *dest, const char *hex,
56 int warn_if_not_exists)
57 {
58 + safe_create_leading_directories(dest);
59 if (use_link) {
60 if (!link(source, dest)) {
61 pull_say("link %s\n", hex);
@@ -150,7 +151,7 @@ static int fetch_file(const unsigned char *sha1)
151 static int object_name_start = -1;
152 static char filename[PATH_MAX];
153 char *hex = sha1_to_hex(sha1);
153 - const char *dest_filename = sha1_file_name(sha1);
154 + char *dest_filename = sha1_file_name(sha1);
155
156 if (object_name_start < 0) {
157 strcpy(filename, path); /* e.g. git.git */