From 677df4855dbaa1c9db3311fbb72a14f33abece2c Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Sat, 8 Jan 2022 14:40:33 -0500 Subject: [PATCH] Use `Base.@kwdef` to automatically provide a kwarg constructor for the `GitVersionInfo` struct with default values --- base/version_git.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/base/version_git.sh b/base/version_git.sh index fbb884648642a9..b1e2cea402a175 100644 --- a/base/version_git.sh +++ b/base/version_git.sh @@ -4,17 +4,17 @@ # This file collects git info and create a julia file with the GIT_VERSION_INFO struct echo "# This file was autogenerated in base/version_git.sh" -echo "struct GitVersionInfo" -echo " commit::String" -echo " commit_short::String" -echo " branch::String" -echo " build_number::Int" -echo " date_string::String" -echo " tagged_commit::Bool" -echo " fork_master_distance::Int" -echo " fork_master_timestamp::Float64" -echo " build_system_commit::String" -echo " build_system_commit_short::String" +echo "Base.@kwdef struct GitVersionInfo" +echo " commit::String = \"\"" +echo " commit_short::String = \"\"" +echo " branch::String = \"\"" +echo " build_number::Int = 0" +echo " date_string::String = \"\"" +echo " tagged_commit::Bool = true" +echo " fork_master_distance::Int = 0" +echo " fork_master_timestamp::Float64 = 0" +echo " build_system_commit::String = \"\"" +echo " build_system_commit_short::String = \"\"" echo "end" echo "" @@ -24,7 +24,7 @@ cd $1 if [ "$#" = "2" -a "$2" = "NO_GIT" ]; then # this comment is used in base/Makefile to distinguish boilerplate echo "# Default output if git is not available." - echo "const GIT_VERSION_INFO = GitVersionInfo(\"\" ,\"\" ,\"\" ,0 ,\"\" ,true ,0 ,0.)" + echo "const GIT_VERSION_INFO = GitVersionInfo()" exit 0 fi # Collect temporary variables