git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem with cg-clone
@ 2005-10-29 17:08 Marcel Holtmann
  2005-10-29 19:41 ` Junio C Hamano
  2005-10-29 19:59 ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Marcel Holtmann @ 2005-10-29 17:08 UTC (permalink / raw)
  To: git

Hi guys,

I installed the latest git and cogito from their repositories and now
the local clone command is failing:

# cg-clone linux-2.6 test-2.6
defaulting to local storage area
Using hard links
`/data/kernel/linux-2.6/.git/HEAD' -> `.git/refs/heads/.origin-fetching'
error: Couldn't find 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404: not separate or in any pack
Cannot obtain needed object 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404
while processing commit 0000000000000000000000000000000000000000.
cg-fetch: objects fetch failed
cg-clone: fetch failed

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?

Regards

Marcel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with cg-clone
  2005-10-29 17:08 Problem with cg-clone Marcel Holtmann
@ 2005-10-29 19:41 ` Junio C Hamano
  2005-10-29 19:57   ` Linus Torvalds
  2005-10-29 19:59 ` Junio C Hamano
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2005-10-29 19:41 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: git

Marcel Holtmann <marcel@holtmann.org> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with cg-clone
  2005-10-29 19:41 ` Junio C Hamano
@ 2005-10-29 19:57   ` Linus Torvalds
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2005-10-29 19:57 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Marcel Holtmann, git



On Sat, 29 Oct 2005, Junio C Hamano wrote:
>
> Marcel Holtmann <marcel@holtmann.org> 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.

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 */

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Problem with cg-clone
  2005-10-29 17:08 Problem with cg-clone Marcel Holtmann
  2005-10-29 19:41 ` Junio C Hamano
@ 2005-10-29 19:59 ` Junio C Hamano
  2005-10-29 20:10   ` Marcel Holtmann
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2005-10-29 19:59 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: git

Marcel Holtmann <marcel@holtmann.org> writes:

> I installed the latest git and cogito from their repositories and now
> the local clone command is failing:
>
> # cg-clone linux-2.6 test-2.6
> defaulting to local storage area
> Using hard links
> `/data/kernel/linux-2.6/.git/HEAD' -> `.git/refs/heads/.origin-fetching'
> error: Couldn't find 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404: not separate or in any pack
> Cannot obtain needed object 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404
> while processing commit 0000000000000000000000000000000000000000.
> cg-fetch: objects fetch failed
> cg-clone: fetch failed

The attached patch should fix git-local-fetch which I think the
above problem is.  git-clone -l -s would be much faster if you
are doing a local clone, however.

---

diff --git a/local-fetch.c b/local-fetch.c
index 87a93de..0a07114 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 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 */

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Problem with cg-clone
  2005-10-29 19:59 ` Junio C Hamano
@ 2005-10-29 20:10   ` Marcel Holtmann
  2005-10-29 20:19     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2005-10-29 20:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

> > I installed the latest git and cogito from their repositories and now
> > the local clone command is failing:
> >
> > # cg-clone linux-2.6 test-2.6
> > defaulting to local storage area
> > Using hard links
> > `/data/kernel/linux-2.6/.git/HEAD' -> `.git/refs/heads/.origin-fetching'
> > error: Couldn't find 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404: not separate or in any pack
> > Cannot obtain needed object 8a212ab6b8a4ccc6f3c3d1beba5f92655c576404
> > while processing commit 0000000000000000000000000000000000000000.
> > cg-fetch: objects fetch failed
> > cg-clone: fetch failed
> 
> The attached patch should fix git-local-fetch which I think the
> above problem is.  git-clone -l -s would be much faster if you
> are doing a local clone, however.

I can confirm that with this patch everything is back to normal.

Regards

Marcel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem with cg-clone
  2005-10-29 20:10   ` Marcel Holtmann
@ 2005-10-29 20:19     ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2005-10-29 20:19 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: git

Marcel Holtmann <marcel@holtmann.org> writes:

>> The attached patch should fix git-local-fetch which I think the
>> above problem is.  git-clone -l -s would be much faster if you
>> are doing a local clone, however.
>
> I can confirm that with this patch everything is back to normal.

Thanks.  What Linus separately done (funny we did that
two-minutes apart) amounts to the same thing.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-10-29 20:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-29 17:08 Problem with cg-clone Marcel Holtmann
2005-10-29 19:41 ` Junio C Hamano
2005-10-29 19:57   ` Linus Torvalds
2005-10-29 19:59 ` Junio C Hamano
2005-10-29 20:10   ` Marcel Holtmann
2005-10-29 20:19     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).