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

[PATCH Cogito] cg-fetch: fix local cloning with symbolic refs

From
Jonas Fonseca <fonseca@diku.dk>
Date
Oct 8, 2005, 17:48 UTC
Message-ID
<20051008174857.GB28875@diku.dk>

Ugly workaround for making the HEAD getter use 'git-symbolic-ref HEAD' so that git-local-fetch is passed the proper ID and not 'ref: ...'.

---

Yeah, it is ugly, it assumes we are getting the HEAD (which is currently the only one using the -b flag.

diff --git a/cg-fetch b/cg-fetch
index d0d37e1..57096cd 100755
--- a/cg-fetch
+++ b/cg-fetch
@@ -248,9 +248,10 @@ fetch_ssh()
 
 get_local()
 {
+	symref=
 	cp_flags_l="-vdpR"
 	if [ "$1" = "-b" ]; then
-		cp_flags_l="-vb" # Dereference symlinks
+		symref=1
 		shift
 	fi
 
@@ -270,6 +271,7 @@ get_local()
 
 	src="$1"
 	dest="$2"
+	[ "$symref" ] && src="$(dirname $src)/$(git-symbolic-ref HEAD)"
 	[ "$cut_last" ] && dest=${dest%/*}
 
 	cp $cp_flags_l "$src" "$dest"
-- 
Jonas Fonseca
Message 1 of 1 in “cg-fetch: fix local cloning with symbolic refs”
  1. cg-fetch: fix local cloning with symbolic refsJonas Fonseca, Oct 8, 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.