git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fetch-pack: start multi-head pulling.

From
Linus Torvalds <torvalds@osdl.org>
Date
Aug 12, 2005, 16:12 UTC
Message-ID
<Pine.LNX.4.58.0508120858420.3295@g5.osdl.org>
In-Reply-To
<7vwtmr4hm5.fsf@assigned-by-dhcp.cox.net>
On Fri, 12 Aug 2005, Junio C Hamano wrote:
Show 7 quoted lines
>
> Linus, I need a bit of guidance from you about this one; an
> ancient commit 4f7770c87ce3c302e1639a7737a6d2531fe4b160 removed
> the multi-head support fetch-pack once had, labelling it as "a
> misguided attempt", and I would like to know if I am making the
> same misguided attempt again.  This update actually makes
> clone-pack almost redundant.
I like your version.

My misguided attempt was not the ability to pull multiple heads, but what to _do_ with them. I originally envisioned something more "git-push-pack" like, where it would pull multiple heads into real references, and _that_ was the misguided part. I then ended up just printing it out to stdout, and that made it "one ref only".

Your version where you just print out multiple heads with names is, I think, the right thing to do.

The shell script looks a bit unreadable to me, personally.
Show 5 quoted lines
>  	head=$(git-fetch-pack "$merge_repo" "$merge_head")
> +	if h=`expr "$head" : '\([^ ][^ ]*\) '`
> +	then
> +	    head=$h
> +	fi

Back-ticks, and the ":" operator to "expr". You really _are_ old-fashioned when it comes to shell ;)

Wouldn't it be simpler/cleaner to just do
	head=($(git-fetch-pack "$merge_repo" "$merge_head"))

which gets you "$head" being the same as ${head[0]}, namely the SHA1 you want (and if you ever implement multi-head pulling, you'll have it all in ${head[..]}..)

			Linus
Previous: Junio C HamanoNext: Johannes Schindelin
Message 2 of 7 in “fetch-pack: start multi-head pulling.”
  1. fetch-pack: start multi-head pulling.Junio C Hamano, Aug 12, 2005
  2. Linus TorvaldsAug 12, 2005
  3. Johannes SchindelinAug 12, 2005
  4. Junio C HamanoAug 12, 2005
  5. Matthias UrlichsAug 13, 2005
  6. Junio C HamanoAug 13, 2005
  7. Linus TorvaldsAug 12, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.