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

head_points_at checked in as 47874d6

From
Yasushi SHOJI <yashi@atmark-techno.com>
Date
Mar 30, 2006, 15:59 UTC
Message-ID
<87fykzyld2.wl@mail2.atmark-techno.com>
Hi Junio,

Would you kindly explain what you are intended to do with the following code checked in as 47874d6d9a7f49ade6388df049597f03365961ca ?

	# The name under $remote_top the remote HEAD seems to point at
	head_points_at=$(
		(
			echo "master"
			cd "$GIT_DIR/$remote_top" &&
			find . -type f -print | sed -e 's/^\.\///'
		) | (
		done=f
		while read name
		do
			test t = $done && continue
			branch_tip=`cat "$GIT_DIR/$remote_top/$name"`
			if test "$head_sha1" = "$branch_tip"
			then
				echo "$name"
				done=t
			fi
		done
		)
	)
What I don't understand are:
- why do we have to do 'echo "master"' for the top of the loop?  is
this an optimization?
- why do we keep looping after done=t?

I just noticed this when I tried to clone a repo _without_ master branch.

Thanks for your time. And sorry for my ignorants.
--
       yashi
Message 1 of 1 in “head_points_at checked in as 47874d6”
  1. Yasushi SHOJIMar 30, 2006

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.