From 563e4fcdf4665829c30a331dd3029c413deea049 Mon Sep 17 00:00:00 2001 From: xPaw Date: Thu, 5 Jun 2014 14:37:37 +0300 Subject: [PATCH] Update versioning script to match SourceMod changes --- support/Versioning | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/support/Versioning b/support/Versioning index ea01a5df..32cc21e4 100644 --- a/support/Versioning +++ b/support/Versioning @@ -1,5 +1,6 @@ # vim: set ts=8 sts=2 sw=2 tw=99 et ft=python: import os, sys +import re builder.SetBuildFolder('/') @@ -17,16 +18,19 @@ outputs = [ ] with open(os.path.join(builder.sourcePath, '.git', 'HEAD')) as fp: - git_state = fp.read().strip().split(':')[1].strip() - -git_head_path = os.path.join(builder.sourcePath, '.git', git_state) -if not os.path.exists(git_head_path): - git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD') + head_contents = fp.read().strip() + if re.search('^[a-fA-F0-9]{40}$', head_contents): + git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD') + else: + git_state = fp.read().strip().split(':')[1].strip() + git_head_path = os.path.join(builder.sourcePath, '.git', git_state) + if not os.path.exists(git_head_path): + git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD') sources = [ os.path.join(builder.sourcePath, 'product.version'), - # This is a hack, but we need some way to only run this script when HG changes. + # This is a hack, but we need some way to only run this script when Git changes. git_head_path, # The script source is a dependency, of course...