FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux User Repository

 
 
LinkBack Thread Tools
 
Old 05-28-2010, 03:24 PM
Philipp
 
Default PKGBUILD-git that actually works with branches

Hi there.
According to http://www.archlinux.org/pacman/PKGBUILD.5.html
PKGBUILD-git.proto should work with git branches, but it doesn't.

I did have quite some trouble to get it to work as expected, but
eventually it was scj7t4 on IRC who wrote a working script for me.

I'd really love to spare other packagers that trouble and would like to
get the improved script into PKGBUILD-git.proto.

I merged it with the original PKGBUILD-git.proto and hope it's fine this
way, but please feel free to make any changes necessary.

http://pastebin.com/deqgqjJe
--

Regards,
Philipp

-----
"Wir stehen selbst enttäuscht und sehn betroffen / Den Vorhang zu und alle Fragen offen." Bertolt Brecht, Der gute Mensch von Sezuan
 
Old 05-28-2010, 05:38 PM
Philipp Überbacher
 
Default PKGBUILD-git that actually works with branches

Excerpts from David Campbell's message of 2010-05-28 20:03:29 +0200:
> Excerpts from Philipp's message of 2010-05-28 11:24:52 -0400:
> > I merged it with the original PKGBUILD-git.proto and hope it's fine this
> > way, but please feel free to make any changes necessary.
> >
> > http://pastebin.com/deqgqjJe
>
> You should probably submit the changes as a patch to what is currently in
> abs[1], with some comments saying what the changes are and maybe why they improve
> the PKGBUILD prototype. That said, I don't know if this mailing list is the
> right place for submitting abs patches.
>
> [1]: http://projects.archlinux.org/abs.git/

I thought this list is appropriate because it's mostly useful to AUR
packagers. I frequently package -git versions, most of the time though
the master branch is what I'm after, and for that the normal
PKGBUILD-git.proto works fine.
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.
--

Regards,
Philipp

-----
"Wir stehen selbst enttäuscht und sehn betroffen / Den Vorhang zu und alle Fragen offen." Bertolt Brecht, Der gute Mensch von Sezuan
 
Old 05-28-2010, 06:03 PM
David Campbell
 
Default PKGBUILD-git that actually works with branches

Excerpts from Philipp's message of 2010-05-28 11:24:52 -0400:
> I merged it with the original PKGBUILD-git.proto and hope it's fine this
> way, but please feel free to make any changes necessary.
>
> http://pastebin.com/deqgqjJe

You should probably submit the changes as a patch to what is currently in
abs[1], with some comments saying what the changes are and maybe why they improve
the PKGBUILD prototype. That said, I don't know if this mailing list is the
right place for submitting abs patches.

[1]: http://projects.archlinux.org/abs.git/
--
David Campbell
 
Old 05-28-2010, 06:49 PM
Sebastian Schwarz
 
Default PKGBUILD-git that actually works with branches

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
 
Old 05-28-2010, 07:39 PM
Philipp Überbacher
 
Default PKGBUILD-git that actually works with branches

Excerpts from Sebastian Schwarz's message of 2010-05-28 20:49:31 +0200:
> 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

Thanks Sebastian, I guess it makes sense, but I get a new message from
git:

Note: checking out 'origin/master'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 0cb24fc... add some text to README
..


--

Regards,
Philipp

-----
"Wir stehen selbst enttäuscht und sehn betroffen / Den Vorhang zu und alle Fragen offen." Bertolt Brecht, Der gute Mensch von Sezuan
 
Old 05-28-2010, 08:18 PM
Sebastian Schwarz
 
Default PKGBUILD-git that actually works with branches

On 2010-05-28 at 21:39 +0200, Philipp Überbacher wrote:
> Thanks Sebastian, I guess it makes sense, but I get a new message from
> git:
>
> (...)

Ah, I forgot about this. To suppress this notice just tell
git-checkout to be `--quiet`.
 
Old 05-28-2010, 08:24 PM
Justin Davis
 
Default PKGBUILD-git that actually works with branches

On May 28, 2010, at 1:18 PM, Sebastian Schwarz wrote:
>
> Ah, I forgot about this. To suppress this notice just tell
> git-checkout to be `--quiet`.


Is there a reason not to just use 'git checkout "$_gitbranch"' instead ?

-Justin
 
Old 05-28-2010, 08:52 PM
Sebastian Schwarz
 
Default PKGBUILD-git that actually works with branches

On 2010-05-28 at 13:24 -0700, Justin Davis wrote:
> Is there a reason not to just use 'git checkout "$_gitbranch"'
> instead?

By default git-clone only creates a remote tracking branch for
master or whichever branch is specified with the `-b` option.
Thus you either have to checkout the branch from the remote,
which defaults to "origin", or tell git to setup with the
desired branch right from the beginning using:

git clone -b "$_gitbranch" "$_gitname" "$_gitroot"

Then additional checkout of $_gitbranch isn't needed.
 
Old 05-28-2010, 10:31 PM
Justin Davis
 
Default PKGBUILD-git that actually works with branches

On May 28, 2010, at 1:52 PM, Sebastian Schwarz wrote:
> By default git-clone only creates a remote tracking branch for
> master or whichever branch is specified with the `-b` option.
> Thus you either have to checkout the branch from the remote,

I am no git wiz but it seems like you are making things more complicated than they have to be. When you type 'git checkout <branchname>' it automatically creates a remote tracking branch. I can see no good reason to checkout the remote branch (the one prefixed with origin/) and force it to suppress its warning when you can just checkout a branch normally.

Your response was informative but did not tell me why you choose a more complicated route, instead of the straightforward 'git checkout <branchname>'.

-Justin
 
Old 05-28-2010, 10:41 PM
Allan McRae
 
Default PKGBUILD-git that actually works with branches

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
 

Thread Tools




All times are GMT. The time now is 10:08 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org