-
Notifications
You must be signed in to change notification settings - Fork 3
Automatic Template Version Injection
The Automatic Template Version Injection development feature of the template is to dynamically inserts current Git revision(via git describe
) into the templates.
This works by implementing Git Attributes configuration file and special Clean/Smudge filters to automatically inserts git revision to template on revision checkout, and removes it while moving changes to the staging area so it won't pollute the actual source code(which is @@TEMPLATE_VERSION@@
dummy string)
A new global parameter, META_BASED_ON_GNU_BASH_SHELL_SCRIPT_TEMPLATE_VERSION
, is intruduced to hold such value so it can also be referenced in script(however currently no attempt for doing so as this further complicates the script). This line(and a few lines that documents it) is inserted in the end of the script to avoid confusion.
## This script is based on the GNU Bash Shell Script Template project
## https://github.com/Lin-Buo-Ren/GNU-Bash-Shell-Script-Template
## and is based on the following version:
declare -r META_BASED_ON_GNU_BASH_SHELL_SCRIPT_TEMPLATE_VERSION="v1.17.2"
## You may rebase your script to incorporate new features and fixes from the template
One of the most practical usage of this feature is that the developer can now compare the template version their scripts based on with the later version of the template and incorporates new feature/fixes from the newer template to the script, which is fairly difficult before since you won't remember which version of template the script is based on
Currently this feature is integrated in all variations of the template, you may consider remove the last few lines if you don't need this feature.
林博仁 et. al. Copyright 2017
License: Creative Commons BY-SA 4.0+