MantisBT - CMake
View Issue Details
0015512CMakeCTestpublic2015-04-13 11:562015-11-02 09:13
trsystran 
 
normaltextalways
closedfixed 
CMake 3.2.1 
CMake 3.3CMake 3.3 
0015512: Fix CTEST_GIT_UPDATE_CUSTOM documentation
Scenario:
Update in ctest the source git checkout to a given git commit revision (sha-1).

It's currently not possible to do that.

* GITUpdateOptions is only appended to "git" "fetch", then a "git" "reset" "--hard" to FETCH_HEAD is done, and "git fetch" only takes refspec, not sha-1 commit revisions, so set(CTEST_GIT_UPDATE_OPTIONS "origin ${REVISION}") doesn't work

* GITUpdateCustom takes only *one* command-line, contrary to what the ctest manual says ("Specify a semicolon-separated list of custom command lines to run in the source tree (Git work tree) to update it instead of running the GITCommand.")
The code (in 2.8.12.2 and 3.2.1, it didn't change) split on ';', then adds each token as an argument of one process execution, not multiple command lines as documented.
So it's not possible do this:
set(CTEST_GIT_UPDATE_CUSTOM "git fetch" "git reset --hard ${REVISION}")
because it will try to execute "git fetch" program, instead of "git".

I haven't found a way to do fetch + reset on a given commit revision in one command (git fetch and git pull take refspec, not revisions, and git rebase take just branches).


Two issues here:
1/ improve documentation to remove the plural mark on "command line" to reflect the current behavior (it's the same wording and issue for P4)
2/ find a solution to update to a given git commit revision (changing CTEST_GIT_UPDATE_CUSTOM behavior to match the documentation would be a breaking change, so it's not the solution.)

With SVN it symply works with set(CTEST_SVN_UPDATE_OPTIONS "-r${REVISION}")
No tags attached.
related to 0014581closed  The git module of CTest doesn't use the nightly timestamp for git update 
Issue History
2015-04-13 11:56trsystranNew Issue
2015-04-13 12:49Brad KingRelationship addedrelated to 0014581
2015-04-13 13:02Brad KingNote Added: 0038496
2015-04-13 13:04Brad KingNote Added: 0038498
2015-04-13 13:11trsystranNote Added: 0038499
2015-04-13 14:10Brad KingSeverityminor => text
2015-04-13 14:10Brad KingStatusnew => resolved
2015-04-13 14:10Brad KingResolutionopen => fixed
2015-04-13 14:10Brad KingFixed in Version => CMake 3.3
2015-04-13 14:10Brad KingTarget Version => CMake 3.3
2015-04-13 14:10Brad KingSummaryCTest git update to specific commit reivision / CTEST_GIT_UPDATE_CUSTOM with multiple git commands => Fix CTEST_GIT_UPDATE_CUSTOM documentation
2015-11-02 09:13Robert MaynardNote Added: 0039769
2015-11-02 09:13Robert MaynardStatusresolved => closed

Notes
(0038496)
Brad King   
2015-04-13 13:02   
I've fixed the documentation, which was just written incorrectly when added:

 Help: Fix {GIT,P4}UpdateCustom documentation
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fef1f267 [^]
(0038498)
Brad King   
2015-04-13 13:04   
When GITUpdateCustom was first added the intention was for it to be the minimum needed for a hook in the right spot. One can use it to invoke another script to do arbitrarily complex logic for the update.
(0038499)
trsystran   
2015-04-13 13:11   
Okay, the script will do.

I consider this issue resolved, thanks!
(0039769)
Robert Maynard   
2015-11-02 09:13   
Closing resolved issues that have not been updated in more than 4 months.