66echo " # This file was autogenerated by base/version_git.sh"
77echo " struct GitVersionInfo"
88echo " commit::String"
9- echo " commit_short ::String"
9+ echo " commit_short_raw ::String"
1010echo " branch::String"
1111echo " build_number::Int"
1212echo " date_string::String"
@@ -17,6 +17,24 @@ echo " build_system_commit::String"
1717echo " build_system_commit_short::String"
1818echo " end"
1919echo " "
20+ echo " function Base.getproperty(info::GitVersionInfo, s::Symbol)"
21+ echo " if s === :commit_short"
22+ echo " commit = getfield(info, :commit_short_raw)"
23+ echo " dirty_file = joinpath(Sys.BINDIR, Base.DATAROOTDIR, \" julia\" , \" base\" , \" version_git_dirty\" )"
24+ echo " dirty_str = try"
25+ echo " read(dirty_file, String)"
26+ echo " catch"
27+ echo " \"\" "
28+ echo " end"
29+ echo " if strip(dirty_str) == \" true\" "
30+ echo " return commit * \" *\" "
31+ echo " end"
32+ echo " return commit"
33+ echo " else"
34+ echo " return getfield(info, s)"
35+ echo " end"
36+ echo " end"
37+ echo " "
2038
2139cd $1
2240
@@ -38,8 +56,9 @@ git_time=$(git log -1 --pretty=format:%ct)
3856commit=$( git rev-parse HEAD)
3957commit_short=$( git rev-parse --short HEAD)
4058if [ -n " $( git status --porcelain) " ]; then
41- # append dirty mark '*' if the repository has uncommitted changes
42- commit_short=" $commit_short " *
59+ dirty=" true"
60+ else
61+ dirty=" false"
4362fi
4463
4564# Our CI system checks commits out as a detached head, and so we must
@@ -117,3 +136,7 @@ echo " $fork_master_timestamp.0,"
117136echo " \" $build_system_commit \" ,"
118137echo " \" $build_system_commit_short \" ,"
119138echo " )"
139+
140+ # Write dirty status to a separate file to avoid triggering rebuilds
141+ # when only the dirty status changes
142+ echo " $dirty " > version_git_dirty
0 commit comments