From 5380d337f5d14fb70b6373fb02c3bf5f50210a13 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Thu, 3 Oct 2013 19:45:00 +0200 Subject: build-snapshot: Fix building non-"master" branches Fix the problem that build-snapshot failed to checkout remote branches. diff --git a/bin/build-snapshot b/bin/build-snapshot index 651edd7..43c6293 100755 --- a/bin/build-snapshot +++ b/bin/build-snapshot @@ -38,7 +38,9 @@ create_snapshot() branch=$1 snapshot_dir=$2 - git checkout --quiet "$branch" + git show-ref --verify --quiet "refs/heads/$branch" \ + || git checkout --quiet --track "origin/$branch" + version=$(git describe --abbrev=4 'HEAD' | sed 's/release-//') tarball="nagios-plugins-$version.tar.gz" symlink="nagios-plugins-$branch.tar.gz" @@ -70,12 +72,12 @@ trap 'tail -n 25 "$log_file" >&3; rm -rf "$temp_dir"' EXIT set -x src_dir="$temp_dir/src" -git clone --quiet --shared "$repository" "$src_dir" +git clone --quiet --shared --no-checkout "$repository" "$src_dir" cd "$src_dir" for branch in $branches do - git show-ref --verify "refs/heads/$branch" \ + git show-ref --verify "refs/remotes/origin/$branch" \ && create_snapshot "$branch" "$snapshot_dir" done -- cgit v0.10-9-g596f