clone --single: limit the fetch refspec to fetched branch
authorRalf Thielow <ralf.thielow@gmail.com>
Thu, 20 Sep 2012 18:04:08 +0000 (20:04 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Sep 2012 21:15:35 +0000 (14:15 -0700)
commit31b808a03290a4f87c571cc1c61f26d8a03c7025
tree7c55f5032cf25b17a413d624c3de2ba61b9ea00b
parent1403db49b80630cf8c36ba3e8b0f085ea0ab8286
clone --single: limit the fetch refspec to fetched branch

After running "git clone --single", the resulting repository has the
usual default "+refs/heads/*:refs/remotes/origin/*" wildcard fetch
refspec installed, which means that a subsequent "git fetch" will
end up grabbing all the other branches.

Update the fetch refspec to cover only the singly cloned ref instead
to correct this.

That means:
If "--single" is used without "--branch" or "--mirror", the
fetch refspec covers the branch on which remote's HEAD points to.
If "--single" is used with "--branch", it'll cover only the branch
specified in the "--branch" option.
If "--single" is combined with "--mirror", then it'll cover all
refs of the cloned repository.
If "--single" is used with "--branch" that specifies a tag, then
it'll cover only the ref for this tag.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-clone.txt
builtin/clone.c
t/t5709-clone-refspec.sh [new file with mode: 0755]