Marcel Holtmann [off-list ref] writes:
Previously this was working fine and since cogito hasn't changed the
last few days, I suspect that git is at fault here or changed something.
Any ideas?
I think I know what is going on.
git-init-db does not create .git/objects/[0-9a-f]{2}/
directories anymore, but git-local-fetch has not taught to
create them on demand.
On Sat, 29 Oct 2005, Junio C Hamano wrote:
Marcel Holtmann [off-list ref] writes:
quoted
Previously this was working fine and since cogito hasn't changed the
last few days, I suspect that git is at fault here or changed something.
Any ideas?
I think I know what is going on.
git-init-db does not create .git/objects/[0-9a-f]{2}/
directories anymore, but git-local-fetch has not taught to
create them on demand.
Here's a quick hack, totally untested, of course.
More properly it should use move_temp_to_file(), but if you're about to do
a v0.99.9 release, maybe this could be good enough.
Linus
---
diff --git a/local-fetch.c b/local-fetch.c
index 87a93de..21f5bf8 100644
--- a/local-fetch.c
+++ b/local-fetch.c
@@ -52,9 +52,20 @@ 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)
{
+ char *dir = strrchr(dest, '/');
+
+ if (dir) {
+ *dir = 0;
+ if (mkdir(dir, 0777)) {
+ if (errno != EEXIST)
+ perror(dir);
+ }
+ *dir = '/';
+ }
+
if (use_link) {
if (!link(source, dest)) {
pull_say("link %s\n", hex);@@ -150,7 +161,7 @@ static int fetch_file(const unsigned cha
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 */