git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <paolo.bonzini@lu.unisi.ch>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] git-fetch, git-parse-remote: Cleanup implementation of '.'
Date: Fri, 16 Mar 2007 09:38:09 +0100	[thread overview]
Message-ID: <45FA5771.1040200@lu.unisi.ch> (raw)
In-Reply-To: <7vr6rqyr60.fsf@assigned-by-dhcp.cox.net>

As per the mailing list exchanges, this applies the following changes:

- renames the data source from 'builtin' to 'self'.

- renames fetch_packs/fetch_heads to fetch_per_ref and fetch_all_at_once

- processes any remote whose URL is '.' (not only the builtin one) using
native-store (this is tested by t3200-branch.sh).

Signed-Off-By: Paolo Bonzini  <bonzini@gnu.org>
---
 git-fetch.sh        |   33 +++++++++++++--------------------
 git-parse-remote.sh |    8 ++++----
 2 files changed, 17 insertions(+), 24 deletions(-)

	The patch is a cleanup of the one you posted, and it was
	appropriately tested with no regression.

	I can see now what you meant by the split between fetch and
	merge logic making my patch more complicated than necessary.

diff --git a/git-fetch.sh b/git-fetch.sh
index 3b01f06..a650116 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -161,7 +161,7 @@ then
 	fi
 fi
 
-fetch_packs () {
+fetch_all_at_once () {
 
   eval=$(echo "$1" | git-fetch--tool parse-reflist "-")
   eval "$eval"
@@ -169,7 +169,9 @@ fetch_packs () {
     ( : subshell because we muck with IFS
       IFS=" 	$LF"
       (
-	if test -f "$remote" ; then
+	if test "$remote" = . ; then
+	    git-show-ref $rref || echo failed "$remote"
+	elif test -f "$remote" ; then
 	    test -n "$shallow_depth" &&
 		die "shallow clone with bundle is not supported"
 	    git-bundle unbundle "$remote" $rref ||
@@ -192,7 +194,7 @@ fetch_packs () {
 
 }
 
-fetch_heads () {
+fetch_per_ref () {
   reflist="$1"
   refs=
   rref=
@@ -286,10 +288,6 @@ fetch_heads () {
 	      rsync_slurped_objects=t
 	  }
 	  ;;
-      .)
-	  local_name=$remote_name
-	  head=$(git-rev-parse --verify "$local_name")
-	  ;;
       esac
 
       append_fetch_head "$head" "$remote" \
@@ -300,19 +298,14 @@ fetch_heads () {
 }
 
 fetch_main () {
-	data_source=$(get_data_source "$remote_nick")
-	if test "$data_source" = builtin; then
-		fetch_heads "$@"
-	else
-		case "$remote" in
-		http://* | https://* | ftp://* | rsync://* )
-			fetch_heads "$@"
-			;;
-		*)
-			fetch_packs "$@"
-			;;
-		esac
-	fi
+	case "$remote" in
+	http://* | https://* | ftp://* | rsync://* )
+		fetch_per_ref "$@"
+		;;
+	*)
+		fetch_all_at_once "$@"
+		;;
+	esac
 }
 
 fetch_main "$reflist" || exit
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index a94215d..f25f9c1 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -10,7 +10,7 @@ get_data_source () {
 		echo ''
 		;;
 	.)
-		echo builtin
+		echo self
 		;;
 	*)
 		if test "$(git-config --get "remote.$1.url")"
@@ -34,7 +34,7 @@ get_remote_url () {
 	'')
 		echo "$1"
 		;;
-	builtin)
+	self)
 		echo "$1"
 		;;
 	config)
@@ -63,7 +63,7 @@ get_default_remote () {
 get_remote_default_refs_for_push () {
 	data_source=$(get_data_source "$1")
 	case "$data_source" in
-	'' | branches | builtin)
+	'' | branches | self)
 		;; # no default push mapping, just send matching refs.
 	config)
 		git-config --get-all "remote.$1.push" ;;
@@ -169,7 +169,7 @@ get_remote_default_refs_for_fetch () {
 	case "$data_source" in
 	'')
 		echo "HEAD:" ;;
-	builtin)
+	self)
 	        canon_refs_list_for_fetch -d "$1" \
 			$(git-show-ref | sed -n 's,.*[      ]\(refs/.*\),\1:,p') ;;
 	config)

  reply	other threads:[~2007-03-16  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-15  8:23 [PATCH, fixed] git-fetch, git-branch: Support local --track via a special remote `.' Paolo Bonzini
2007-03-16  0:21 ` Junio C Hamano
2007-03-16  8:38   ` Paolo Bonzini [this message]
2007-03-16  9:32     ` [PATCH] git-fetch, git-parse-remote: Cleanup implementation of '.' Junio C Hamano
2007-03-16  9:38       ` Paolo Bonzini
2007-03-16 10:00         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45FA5771.1040200@lu.unisi.ch \
    --to=paolo.bonzini@lu.unisi.ch \
    --cc=bonzini@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).