Re: [PATCH, fixed] git-fetch, git-branch: Support local --track via a special remote `.'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paolo Bonzini <bonzini@xxxxxxx> writes:

> 	To make the name of fetch_dumb more consistent with the
> 	functionality, I renamed it to fetch_heads, as well as
> 	renaming fetch_native to fetch_packs.

I agree renaming fetch_dumb vs fetch_native to names that
reflect their nature better might be a good idea.  The former is
to perform fetching objects and updating tracking ref for one
ref at a time, while the latter is to do the fetching and
updating all relevant tracking refs in one go.  The 'per-ref'
behaviour is exactly why the former is called "dumb".

If you really want to rename, perhaps making the former
fetch_per_ref and the latter fetch_all_at_once would reflect
their nature better.  While I do not have strong preference
either way, I think "fetch_head" is a slight improvement over
"fetch_dumb", because it tells that "per-ref" nature a bit
better, and "fetch_pack" is not any better than "fetch_native".

While talking about names, I think calling data_source 'builtin'
feels very wrong, as we _might_ want to later add other kinds of
repository the system knows about.  I would have picked 'self',
as this change is about referring the repository itself using a
fake name '.' for it.

I think it would be a lot more efficient if you made the 'self'
fetch piggyback on fetch_all_at_once side, like the attached
patch.

This is on top of your patch to illustrate the difference, and
does not have the renaming I suggested (i.e. dumb->per_ref,
packs->all_at_once, and builtin->self).

diff --git a/git-fetch.sh b/git-fetch.sh
index cbbb5ca..ffe6847 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -170,6 +170,10 @@ fetch_packs () {
 		die "shallow clone with bundle is not supported"
 	    git-bundle unbundle "$remote" $rref ||
 	    echo failed "$remote"
+	elif test "." = "$remote"
+	then
+		git-show-ref $rref ||
+		echo failed .
 	else
 	  git-fetch-pack --thin $exec $keep $shallow_depth $no_progress \
 		"$remote" $rref ||
@@ -280,10 +284,6 @@ fetch_heads () {
 	      rsync_slurped_objects=t
 	  }
 	  ;;
-      .)
-	  local_name=$remote_name
-	  head=$(git-rev-parse --verify "$local_name")
-	  ;;
       esac
 
       append_fetch_head "$head" "$remote" \
@@ -296,7 +296,7 @@ fetch_heads () {
 fetch_main () {
 	data_source=$(get_data_source "$remote_nick")
 	if test "$data_source" = builtin; then
-		fetch_heads "$@"
+		fetch_packs "$@"
 	else
 		case "$remote" in
 		http://* | https://* | ftp://* | rsync://* )

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]