diff --git a/src/TwigMisuzu.php b/src/TwigMisuzu.php index 7f9fe525..0fa38a96 100644 --- a/src/TwigMisuzu.php +++ b/src/TwigMisuzu.php @@ -37,6 +37,7 @@ final class TwigMisuzu extends Twig_Extension new Twig_Function('get_browser', 'get_browser'), new Twig_Function('git_commit_hash', 'git_commit_hash'), new Twig_Function('git_tag', 'git_tag'), + new Twig_Function('git_branch', 'git_branch'), new Twig_Function('csrf_token', 'csrf_token'), new Twig_Function('csrf_input', 'csrf_html'), new Twig_Function('sql_query_count', 'db_query_count'), diff --git a/src/git.php b/src/git.php index ec8c1314..521157c6 100644 --- a/src/git.php +++ b/src/git.php @@ -13,6 +13,11 @@ function git_commit_hash(bool $long = false): string return git_commit_info($long ? MSZ_GIT_FORMAT_HASH_LONG : MSZ_GIT_FORMAT_HASH_SHORT); } +function git_branch(): string +{ + return trim(shell_exec('git rev-parse --abbrev-ref HEAD')); +} + function git_tag(): string { return trim(shell_exec('git describe --abbrev=0 --tags')); diff --git a/templates/_layout/footer.twig b/templates/_layout/footer.twig index 64d8819f..8141485d 100644 --- a/templates/_layout/footer.twig +++ b/templates/_layout/footer.twig @@ -2,11 +2,16 @@