Mailinglist Archive: opensuse-buildservice (256 mails)

< Previous Next >
RE: [opensuse-buildservice] [PATCH 1/3] [obs-service-tar_scm] Checkout master before git update
  • From: "Markus Lehtonen" <markus.lehtonen@xxxxxxxxxxxxxxx>
  • Date: Mon, 29 Aug 2011 17:08:47 +0300
  • Message-id: <002401cc6655$2cbbf2f0$8633d8d0$>
On 2011/08/29 at 15:06:06, Adrian Schröter wrote:

Am Freitag, 26. August 2011, 12:42:06 schrieb Markus Lehtonen:
On 2011/08/26 at 09:36:52, Adrian Schröter wrote:

We may should do


here instead ?

Hmm, shouldn't matter, AFAIU. I see one potential problem, though.
If the git HEAD on the remote server points to something else than
refs/heads/master, let's say refs/heads/upstream. Then git clone
create branch 'upstream' and there'd be no master branch and
checkout would fail. I don't then know how to nicely checkout the
branch", i.e.
how to determine the name of that branch. Something like?
git fetch
DEFAULTBRANCH=`sed s'!^ref.*/!!' .git/refs/remotes/origin/HEAD`
git checkout $DEFAULTBRANCH
git merge

What do you think?

Hm, I would avoid to handle the DEFAULTBRANCH at all. It is just
important for us to handle OUR branch. So my code would be this:

if [ -n "$MYREVISION" ]; then
git fetch $MYGITARGS || exit 1
git checkout "$MYREVISION" || exit 1
git merge "origin/$MYREVISION" HEAD || exit 1
git pull $MYGITARGS || exit 1

and leave it to "git pull" to handle the default branch if needed.
Does this make sense ?

Mm, it basically makes sense.

However, the pull fails if I first define MYREVISION but later remove it.
The repo is in the "detached head" state (i.e. non-branch) which is not
updated at all as pull fails. AFAIK, pull doesn't know how to handle "a
default branch" it only fetches and tries to merge for the current branch. I
don't know how relevant corner case this is, though.


To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >