Re: How to clone-pack the HEAD?

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

Re: How to clone-pack the HEAD?

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

Petr Baudis [off-list ref] writes:
  (i) git-clone-pack url HEAD doesn't work
"clone-pack url branchname" might work, but the thing is, nobody
uses clone-pack with explicit heads arguments so if HEAD does
not work I am not surprised at all.
  (ii) git-clone-pack has hardcoded assumptions about refs/heads/master
I've read that part of the code twice in the past, but my
recollection is it tries hard to "guess" where HEAD points at
(because the remote side does not tell us, other than which
commit object HEAD points at).  When more than two branch heads
point at the same commit as HEAD records, it gives preference to
"master" branch while guessing, but otherwise there is nothing
special about the "master" branch.

The problem is, clone-pack is about cloning and not fetching.  I
am not claiming it is the right design decision --- after all,
it was the oldest of the git native protocol driver suite ---
but just stating where it stands with all the history behind its
(and git-fetch-pack's) evolution.

I think extending git-fetch-pack to optionally keep things
packed would be somewhat painful but the right approach.  Less
painful and readily doable would be to run clone-pack as is, and
reorganize the result of "copy of the remote" yourself.  That
would be a straightforward thing to do if you are using it for
the initial cloning.

Re: How to clone-pack the HEAD?

From: Petr Baudis <hidden>
Date: 2016-06-15 22:42:14

Dear diary, on Thu, Dec 15, 2005 at 02:20:28AM CET, I got a letter
where Junio C Hamano [off-list ref] said that...
Petr Baudis [off-list ref] writes:
quoted
  (i) git-clone-pack url HEAD doesn't work
"clone-pack url branchname" might work, but the thing is, nobody
uses clone-pack with explicit heads arguments so if HEAD does
not work I am not surprised at all.
..snip..
I think extending git-fetch-pack to optionally keep things
packed would be somewhat painful but the right approach.  Less
painful and readily doable would be to run clone-pack as is, and
reorganize the result of "copy of the remote" yourself.  That
would be a straightforward thing to do if you are using it for
the initial cloning.
Except that I cannot do the guessing git-clone-pack does (without
fetching all the branches) - so I guess I'll make a patch tomorrow which
fixes git-clone-pack ... HEAD (probably by checking in write_one_ref()
whether it is looking at a symlink and following it first if that's the
case) and then in Cogito do

	git-symbolic-ref HEAD refs/heads/origin

before git-clone-pack (and repoint HEAD back after it's over). That
should do exactly what I need it to, I think.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help