• Ralf Thielow's avatar
    clone --single: limit the fetch refspec to fetched branch · 31b808a0
    Ralf Thielow authored
    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: default avatarRalf Thielow <ralf.thielow@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
t5709-clone-refspec.sh 3.73 KB