[CMake] New version of FindGit.cmake compatible with FindSubversion.cmake

Rolf Eike Beer eike at sf-mail.de
Thu Jul 12 02:52:10 EDT 2012


Mateusz Loskot wrote:
> On 12 July 2012 00:24, Aashish Chaudhary <aashish.chaudhary at kitware.com> 
wrote:
> > Hi Mateusz,
> > 
> > I don't have both files in front of me. Whats the difference between
> > the one in the slicer and once in the CMake?
> 
> CMake's current version [1] defines:
> 
>  #   GIT_EXECUTABLE - path to git command line client
> #   GIT_FOUND - true if the command line client was found
> #   GIT_VERSION_STRING - the version of git found (since CMake 2.8.8)
> 
> Slicer's version [2] defines:
> 
> # The module defines the following variables:
> #   GIT_EXECUTABLE - path to git command line client
> #   GIT_FOUND - true if the command line client was found
> #
> # If the command line client executable is found the macro
> #  GIT_WC_INFO(<dir> <var-prefix>)
> # is defined to extract information of a git working copy at
> # a given location.
> #
> # The macro defines the following variables:
> #  <var-prefix>_WC_REVISION_HASH - Current SHA1 hash
> #  <var-prefix>_WC_REVISION - Current SHA1 hash
> #  <var-prefix>_WC_REVISION_NAME - Name associated with
> <var-prefix>_WC_REVISION_HASH
> #  <var-prefix>_WC_URL - output of command `git config --get
> remote.origin.url' #  <var-prefix>_WC_ROOT - Same value as working copy URL
> #  <var-prefix>_WC_GITSVN - Set to false
> #
> # ... and also the following ones if it's a git-svn repository:
> #  <var-prefix>_WC_GITSVN - Set to True if it is a
> #  <var-prefix>_WC_INFO - output of command `git svn info'
> #  <var-prefix>_WC_URL - url of the associated SVN repository
> #  <var-prefix>_WC_ROOT - root url of the associated SVN repository
> #  <var-prefix>_WC_REVISION - current SVN revision number
> #  <var-prefix>_WC_LAST_CHANGED_AUTHOR - author of last commit
> #  <var-prefix>_WC_LAST_CHANGED_DATE - date of last commit
> #  <var-prefix>_WC_LAST_CHANGED_REV - revision of last commit
> #  <var-prefix>_WC_LAST_CHANGED_LOG - last log of base revision

I'm not against that change, but I find the documentation a bit misleading. 
When reading it my first thought was that _WC_REVISION and _WC_GITSVN are junk, 
just to learn later that they have different meaning when it's a git-svn repo.

Looking at the code I think that line 115 (which is: if(NOT 
"${git_config_output}" STREQUAL "")) could be simplified to 
"if(git_config_output)". The warning in line 144 looks suspicious to me, that 
would e.g. trigger on a local only git repo, no? Maybe make this an 
AUTHOR_WARNING?

And obviously the version extraction code is missing, but this should be 
trivially fixable.

Greetings,

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120712/37a25422/attachment.pgp>


More information about the CMake mailing list