[CMake] Git Doesn't to Pull with ExternalProject_Add

Constantine Zakkaroff mnkz at leeds.ac.uk
Thu Nov 14 06:03:33 EST 2013


Hi Daniele,

Thanks for your response. Yes, the ${proj}_GIT_TAG? was simply set to 
master.

You are right, there's nothing in the documentation about it. Say, 
normally, if I'm working with a git repository, and if your branch is 
set to master, all you need to do is 'git pull' when you want to update 
your local master, so I'd hope the same behaviour during the external 
project update. But I don't even see anything in the build log 
indicating CMake attempted to update the project.

I can see in the C:\Program Files (x86)\CMake 
2.8\share\cmake-2.8\Modules\ExternalProject.cmake file (which is where 
the ExternalProject_Add function is defined) there this line (1519):

set(comment "Performing update step for '${name}'")

I think I've seen this line only once, immediately after the initial 
repository cloning.

Now, setting ${proj}_GIT_TAG to "origin/master" seems to improve things. 
I got this output:

1>------ Build started: Project: ITKv4, Configuration: Release x64 ------
1>Performing update step for 'ITKv4'
1>-- ***RunningE:/Dev/ITKSoftwareGuide/SuperBuild/External_ITKv4.cmake***
1>From git://itk.org/ITK
1>   bf180e2..8e7d867  master     -> origin/master
1>   66743fc..07f48b6  dashboard  -> origin/dashboard
1>   bf180e2..d0638da  nightly-master -> origin/nightly-master
1>Note: checking out 'origin/master'.
1>You are in 'detached HEAD' state. You can look around, make experimental
1>changes and commit them, and you can discard any commits you make in this
1>state without impacting any branches by performing another checkout.
1>If you want to create a new branch to retain commits you create, you may
1>do so (now or later) by using -b with the checkout command again. Example:
1>  git checkout -b new_branch_name
1>HEAD is now at 8e7d867... COMP: Fix warnings from VTK dashboard, 
contributed by Sean McBride
1>Performing configure step for 'ITKv4'
1> [... and so on ...]
Does this mean the local repository has been updated? This is beyond my 
knowledge of git, because I'm not sure I understand the implications of 
the "You are in 'detached HEAD' state", which sounds a bit scary in the 
good old Headless Horseman way, but I'm not sure I need to be alarmed in 
the given situation. ;)

I can see from command line that the branch has been set to this:

mnkz at CSPCX174 /e/Dev/ITKSoftwareGuide.Out/ITKv4 ((8e7d867...))
$ git branch
* (detached from origin/master)
   master

I know from command line I can do this (if I'm on master branch):

git remote update
git show-branch *master
git status

That would tell me if my local repository behind the remote one, but I'm 
not sure what to do if I'm in 'detached HEAD' state.

Basically, is there a way to verify the latest repository updates have 
been pulled?

Many thanks,
Constantine




On 13/11/2013 11:35, Daniele E. Domenichelli wrote:
> Hello Constantine,
>
> I'm investigating the same issue right in this moment...
>
> On 13/11/13 10:19, Constantine Zakkaroff wrote:
>> I have a SuperBuild project (using CMake 2.8.12 on Windows Vista x64)
>> depending on some other project cloned from a git repository. However
>> I've noticed the cloner repository doesn't get updated when I rebuild
>> the project.
>>
>> Is it right to expect the repository to be updated automatically? Or
>> does it need to be done manually?
>
> How do you set ${proj}_GIT_TAG? If it a tag or a commit hash it should
> work, therefore if you change it in your superbuild, your repository
> should be updated.
>
> Unfortunately it doesn't work for branches. Therefore if you set it to
> "master" it will work for the clone, but it won't work for the updates,
> because the branch "master" is your local branch not the remote one
> ("origin/master")
>
> Perhaps this should be fixed somehow, either the documentation of the
> module to explicitly state this, or the module itself to pull from the
> remote branch if GIT_TAG is a branch.
>
>
> Cheers,
>   Daniele
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list