WIP: Draft for a libgit2 implementation of version_git #5629
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@StefanKarpinski indicated that he would want to use libgit2 to avoid compatibility problems with systems that use different versions of git. (see: #5587 (comment) )
This is a humble attempt to implement a simple C program to generate our
version_git.jl
file.Missing features:
GIT_VERSION_INFO.date_string
as a string but as a timestamp.*
to theGIT_VERSION_INFO.commit_short
field.Testing this is fairly easy:
and it finds the repository in the current directory, just like regular git.
I hoped that this would be faster than the current shell script, but unfortunately plain git seems to be so much better to do parallel file access, that on first run on a cold machine, the shell script version is 3-4 times faster. After many runs, the libgit2 version is twice as fast, but
version_git.jl
will never be generated in a loop, so the asymptotic runtime is irrelevant.I am posting this too see if there is interest in merging this when libgit2 becomes a dependency, and to give others that might want to try this a better starting point and a word of caution on the performance. It will add lots of dependencies for
make sourcedist
, and increase generalmake
time, so I do not think it is worth to include this in the regular make process.