[aur-general] PKGBUILD-git that actually works with branches

Allan McRae allan at archlinux.org
Fri May 28 18:41:24 EDT 2010


On 29/05/10 04:49, Sebastian Schwarz wrote:
> On 2010-05-28 at 19:38 +0200, Philipp Überbacher wrote:
>> That's why I defaulted to "master", but I get the following error:
>> fatal: git checkout: branch master already exists
>>
>> It works, but I need some input on whether and how the default case
>> can be handled more gracefully.
>
> There isn't really a need to create a new branch if you just
> want to do a checkout.  Simply change
>
>      git checkout --track -b  ${_gitbranch} origin/${_gitbranch}
>
> in http://pastebin.com/deqgqjJe to
>
>      git checkout origin/${_gitbranch}
>
> See the amendment of the paste at http://pastebin.com/C8sC7wAe
>

I have been using this for my makepkg-git package for ages:

   if [ -d $_gitname ] ; then
     cd $_gitname && git pull origin working
     msg "The local files are updated."
   else
     git clone $_gitroot
     cd $_gitname && git checkout origin/working
   fi

Seems to work...

Allan



More information about the aur-general mailing list