download_and_compile.sh: replace manually set version with the Git blob ID
By setting the 'ident' attribute for /download_and_compile.sh, this replacement will be automatic whenever the file is checked out. Note: the ID is the 40-character hexadecimal blob object name in Git, it is *not* the commit ID. 'git show <id>' can be used to obtain the script contents from its blob object name (id). This will avoid spoiling every diff with the version number change, or alternatively having different versions of the same file displaying and logging the same version number. If download_and_compile.sh is moved to a different directory in FGMeta (or even renamed), then the path in .gitattributes must be adapted for the substitution to work (the '/' in .gitattributes anchors the match at the containing directory; I did this because download_and_compile.sh is a rather generic name, and there *might* be different scripts with the same name in other dirs...).
This commit is contained in:
parent
e8fb2f58f2
commit
5fa23309c5
2 changed files with 10 additions and 1 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -20,3 +20,4 @@ README.* text
|
||||||
Makefile text
|
Makefile text
|
||||||
ChangeLog text
|
ChangeLog text
|
||||||
ChangeLog.* text
|
ChangeLog.* text
|
||||||
|
/download_and_compile.sh text ident
|
||||||
|
|
|
@ -17,7 +17,15 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
VERSION="2.34"
|
script_blob_id='$Id$'
|
||||||
|
# Slightly tricky substitution to avoid our regexp being wildly replaced with
|
||||||
|
# the blob name (id) when the script is checked out:
|
||||||
|
#
|
||||||
|
# First extract the hexadecimal blob object name followed by a '$'
|
||||||
|
VERSION="$(echo "$script_blob_id" | sed 's@\$Id: *\([0-9a-f]\+\) *@\1@')"
|
||||||
|
# Then remove the trailing '$'
|
||||||
|
VERSION="${VERSION%\$}"
|
||||||
|
|
||||||
FGVERSION="release/$(git ls-remote --heads https://git.code.sf.net/p/flightgear/flightgear|grep '\/release\/'|cut -f4 -d'/'|sort -t . -k 1,1n -k2,2n -k3,3n|tail -1)"
|
FGVERSION="release/$(git ls-remote --heads https://git.code.sf.net/p/flightgear/flightgear|grep '\/release\/'|cut -f4 -d'/'|sort -t . -k 1,1n -k2,2n -k3,3n|tail -1)"
|
||||||
|
|
||||||
#######################################################
|
#######################################################
|
||||||
|
|
Loading…
Reference in a new issue