aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2010-10-11 21:38:42 -0400
committerGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2010-10-11 21:38:42 -0400
commit654086f1117ee22d9f7e8270330daff6c463c9ad (patch)
tree0a6bb92594ed7dd820cf1b12bc6cf9c7cadd1bf9 /tools
parente30f77864054e54f3c777aee0315f9c13b10957d (diff)
downloadmonitoring-plugins-654086f1117ee22d9f7e8270330daff6c463c9ad.tar.gz
sfsnapshotgit: Better handling of remote refs
This commit allow to track branches from unusually-named remote refs and makes possible using external remotes (other than origin) for snapshots.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sfsnapshotgit14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/sfsnapshotgit b/tools/sfsnapshotgit
index e79dd553..8bc19fce 100755
--- a/tools/sfsnapshotgit
+++ b/tools/sfsnapshotgit
@@ -44,11 +44,17 @@ cd "$SFSNAP_REPO"
# Sometimes "make dist" can modify versioned files so we must reset first
git reset --hard
git clean -qfdx
-# Any branch used to create snapshots must already exist
+
+# Any branch used to create snapshots must already exist and be properly configured
git checkout "$HEAD"
-git fetch "$SFSNAP_ORIGIN"
-git reset --hard "$SFSNAP_ORIGIN"/"$HEAD"
-# Tags are important for git-describe
+
+# Get the remote tracking branch from config
+origin=$(git config branch.$HEAD.remote)
+ref=$(git config branch.$HEAD.merge |sed -e 's|^refs/heads/||')
+git fetch "$origin"
+git reset --hard "$origin/$ref"
+
+# Tags are important for git-describe, but take only the ones from the hard-coded origin
git fetch --tags "$SFSNAP_ORIGIN"
# Write our snapshot version string (similar to NP-VERSION-GEN) to "release"