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

Mateusz Loskot mateusz at loskot.net
Thu Jul 12 06:52:38 EDT 2012


On 12 July 2012 07:52, Rolf Eike Beer <eike at sf-mail.de> wrote:
> Mateusz Loskot wrote:
>> On 12 July 2012 00:24, Aashish Chaudhary <aashish.chaudhary at kitware.com> wrote:
>> >
>> > 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.

That's what documentation is for, to clarify unobvious.

> 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?

Let's assume it is a requirement specific to the Slicer project.
I think, the warning could be simply removed.

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

What version you mean? Git program version?
Or, the TODO comment in line 71 of the Slicer's FindGit.cmake?

My main point is to get someone from CMake team to simply grab the
Slicer's version
and commit to CMake upstream. Can't see reasons why it couldn't be
submitted really.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the CMake mailing list