Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions base/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
/uv_constants.jl
/version_git.jl
/version_git.jl.phony
/version_git_dirty
/userimg.jl
/JuliaSyntax
1 change: 1 addition & 0 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,5 @@ clean:
-rm -f $(BUILDDIR)/file_constants.jl
-rm -f $(BUILDDIR)/version_git.jl
-rm -f $(BUILDDIR)/version_git.jl.phony
-rm -f $(BUILDDIR)/version_git_dirty
-rm -f $(build_private_libdir)/lib*.$(SHLIB_EXT)*
29 changes: 26 additions & 3 deletions base/version_git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
echo "# This file was autogenerated by base/version_git.sh"
echo "struct GitVersionInfo"
echo " commit::String"
echo " commit_short::String"
echo " commit_short_raw::String"
echo " branch::String"
echo " build_number::Int"
echo " date_string::String"
Expand All @@ -17,6 +17,24 @@ echo " build_system_commit::String"
echo " build_system_commit_short::String"
echo "end"
echo ""
echo "function Base.getproperty(info::GitVersionInfo, s::Symbol)"
echo " if s === :commit_short"
echo " commit = getfield(info, :commit_short_raw)"
echo " dirty_file = joinpath(Sys.BINDIR, Base.DATAROOTDIR, \"julia\", \"base\", \"version_git_dirty\")"
echo " dirty_str = try"
echo " read(dirty_file, String)"
echo " catch"
echo " \"\""
echo " end"
echo " if strip(dirty_str) == \"true\""
echo " return commit * \"*\""
echo " end"
echo " return commit"
echo " else"
echo " return getfield(info, s)"
echo " end"
echo "end"
echo ""

cd $1

Expand All @@ -38,8 +56,9 @@ git_time=$(git log -1 --pretty=format:%ct)
commit=$(git rev-parse HEAD)
commit_short=$(git rev-parse --short HEAD)
if [ -n "$(git status --porcelain)" ]; then
Copy link
Copy Markdown
Member

@vtjnash vtjnash Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we instead change this to git status --porcelain ${COMPILER_SRCS} ${BASE_SRCS} ${STDLIB_SRCS} (these variables are defined during sysimage.mk), which seems like it should have the equivalent effect, but without the awkward build stickiness of this current implementation just failing to track a particular changed file, and now just generally does not correctly report whether the build was dirty (or not) when the sysimage was built?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a stdlib changes we don't need to rebuild the sysimage, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively/secondly, could we move this file to only be included in the very last stage of building sys.so, so that it doesn't invalidate sysbase.so, even if the dirty bit did change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a stdlib changes we don't need to rebuild the sysimage, right?

That variable is the source of files that are in the sysimage (SYSIMG_STDLIBS_SRCS vs INDEPENDENT_STDLIBS_SRCS)

# append dirty mark '*' if the repository has uncommitted changes
commit_short="$commit_short"*
dirty="true"
else
dirty="false"
fi

# Our CI system checks commits out as a detached head, and so we must
Expand Down Expand Up @@ -117,3 +136,7 @@ echo " $fork_master_timestamp.0,"
echo " \"$build_system_commit\","
echo " \"$build_system_commit_short\","
echo ")"

# Write dirty status to a separate file to avoid triggering rebuilds
# when only the dirty status changes
echo "$dirty" > version_git_dirty
2 changes: 1 addition & 1 deletion stdlib/InteractiveUtils/src/InteractiveUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ See also: [`VERSION`](@ref).
"""
function versioninfo(io::IO=stdout; verbose::Bool=false)
println(io, "Julia Version $VERSION")
if !isempty(Base.GIT_VERSION_INFO.commit_short)
if !isempty(Base.GIT_VERSION_INFO.commit_short_raw)
println(io, "Commit $(Base.GIT_VERSION_INFO.commit_short) ($(Base.GIT_VERSION_INFO.date_string))")
end
official_release = Base.TAGGED_RELEASE_BANNER == "Official https://julialang.org release"
Expand Down