Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Draft for a libgit2 implementation of version_git #5629

Closed
wants to merge 1 commit into from

Conversation

ivarne
Copy link
Member

@ivarne ivarne commented Jan 31, 2014

@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:

  • It does not format the GIT_VERSION_INFO.date_string as a string but as a timestamp.
  • It does not check for uncommitted changes to add a * to the GIT_VERSION_INFO.commit_short field.

Testing this is fairly easy:

cd ui
gcc -Wall -o version_git version_git.c -lgit2 && ./version_git

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 general make time, so I do not think it is worth to include this in the regular make process.

@ivarne
Copy link
Member Author

ivarne commented Feb 2, 2014

This caught about the level of enthusiasm as I expected, so I think this will be preserved for the future as a closed issue. The shellscript works fine in most cases, and the probability that this will cause problems for someone when merged is significant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant