Re: Problem with cg-clone

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Problem with cg-clone

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:10

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.

Re: Problem with cg-clone

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:10


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 */
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help