git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Cogito] cg-fetch: fix local cloning with symbolic refs
@ 2005-10-08 17:48 Jonas Fonseca
  0 siblings, 0 replies; only message in thread
From: Jonas Fonseca @ 2005-10-08 17:48 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-08 17:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-08 17:48 [PATCH Cogito] cg-fetch: fix local cloning with symbolic refs Jonas Fonseca

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).