Re: git clone -b
- From
Phil Hord <phil.hord@gmail.com>
- Date
- Jul 1, 2013, 17:49 UTC
- Message-ID
- <CABURp0oQ9MNGZecD4mkniXMEUJ5L7Xn+JFQMEgc97Mfe26JYvg@mail.gmail.com>
- In-Reply-To
- <51D12A0E.60709@atlas-elektronik.com>
It would be nice to support more generic specs for the --branch switch. But it is complicated because the refs have not been fetched yet during the clone, and so normal refs operations -- which expect to work on a local repository -- do not work. So, the ref is looked up locally from a list in expected locations after fetching the remote refs but before the clone occurs. The remote refs which are fetched is not configurable during clone, and so only 'refs/heads/*' is fetched for non-mirrors.
I was able to tweak git-clone to fetch the remote ref when I hacked builtin/clone.c to check in 'refs' and also to extend the refspec to something more broad ("+refs/*:refs/remotes/origin/*"), but this is not a workable solution. But there probably is a more correct way than the hack I tried.
Phil