diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-10-12 01:38:42 (GMT) |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-10-12 01:38:42 (GMT) |
commit | 654086f1117ee22d9f7e8270330daff6c463c9ad (patch) | |
tree | 0a6bb92594ed7dd820cf1b12bc6cf9c7cadd1bf9 /tools | |
parent | e30f77864054e54f3c777aee0315f9c13b10957d (diff) | |
download | monitoring-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-x | tools/sfsnapshotgit | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/sfsnapshotgit b/tools/sfsnapshotgit index e79dd55..8bc19fc 100755 --- a/tools/sfsnapshotgit +++ b/tools/sfsnapshotgit | |||
@@ -44,11 +44,17 @@ cd "$SFSNAP_REPO" | |||
44 | # Sometimes "make dist" can modify versioned files so we must reset first | 44 | # Sometimes "make dist" can modify versioned files so we must reset first |
45 | git reset --hard | 45 | git reset --hard |
46 | git clean -qfdx | 46 | git clean -qfdx |
47 | # Any branch used to create snapshots must already exist | 47 | |
48 | # Any branch used to create snapshots must already exist and be properly configured | ||
48 | git checkout "$HEAD" | 49 | git checkout "$HEAD" |
49 | git fetch "$SFSNAP_ORIGIN" | 50 | |
50 | git reset --hard "$SFSNAP_ORIGIN"/"$HEAD" | 51 | # Get the remote tracking branch from config |
51 | # Tags are important for git-describe | 52 | origin=$(git config branch.$HEAD.remote) |
53 | ref=$(git config branch.$HEAD.merge |sed -e 's|^refs/heads/||') | ||
54 | git fetch "$origin" | ||
55 | git reset --hard "$origin/$ref" | ||
56 | |||
57 | # Tags are important for git-describe, but take only the ones from the hard-coded origin | ||
52 | git fetch --tags "$SFSNAP_ORIGIN" | 58 | git fetch --tags "$SFSNAP_ORIGIN" |
53 | 59 | ||
54 | # Write our snapshot version string (similar to NP-VERSION-GEN) to "release" | 60 | # Write our snapshot version string (similar to NP-VERSION-GEN) to "release" |