Re: [PATCH] clone: add refs/remotes/* to Pull: targets when cloning

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

 



Eric Wong <normalperson@xxxxxxxx> writes:

> diff --git a/git-clone.sh b/git-clone.sh
> index 4ed861d..a8ab7fd 100755
> --- a/git-clone.sh
> +++ b/git-clone.sh
> @@ -249,6 +249,12 @@ Pull: $head_points_at:$origin" &&
>  			test "$origin" = "$head" ||
>  			echo "Pull: ${head}:${head}"
>  		done >>"$GIT_DIR/remotes/origin"
> +		(test -d "$GIT_DIR"/refs/remotes && cd "$GIT_DIR" &&
> +		 find "refs/remotes" -type f -print | sed -e 's|^refs/||') |
> +		while read ref
> +		do
> +			echo "Pull: $ref:$ref"
> +		done >>"$GIT_DIR/remotes/origin"
>  	esac

I am not sure I agree with what you are doing here.  I thought
the idea behind refs/remotes is to migrate away from copying all
the remote heads into refs/heads (so that Linus does not need to
see my "next" and "pu" under his refs/heads), and putting
foreign SCM tracking branches used by SVN and CVS importers in
there instead of in refs/heads naturally falls out from that
pattern.

Now I do not propose to change the current clone that
contaminates the local branch namespace by copying remote
refs/heads into local refs/heads in the middle of v1.3.0
development without laying out a transition plan, but I think
that is a sensible future direction.  Instead of copying
everything from refs/heads to refs/heads, we only copy what
remote HEAD points at to refs/heads/master to initialize the
local clone, and copy everything from refs/heads to
refs/remotes, _and_ set up Pull: lines to do the same tracking.
The part of the code you are touching corresponds to the last
part.

We would probably be better off not doing this right now.  When
we are sure everybody thinks it is a better approach to use
refs/remotes for remote branch tracking, we would need to change
the part you did not change (I think the clone-pack part is the
hardest to change since it has a built-in "copy refs to matching
locations" logic) alongside with the part you touched with this
patch to make things consistent.  At that time also you would
need to remove several lines above the part you touched so that
we do not use local refs/heads/* for tracking.

How does that sound?


-
: 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]