Git's diff-tree format has no '\n'-terminated blank line at the end of
its commit message body block if there are no diff lines. Instead the
message body is terminated by '\0' and there is no diff section. Teach
CTest to parse the format in this case.
Use 'git fetch' followed by 'git reset' to update the source tree. This
is better than 'git pull' because it can handle a rewritten upstream
branch and does not leave local modifications. After fetch, parse
FETCH_HEAD to find the merge head that 'git pull' would choose to track
the upstream branch. Then reset to the selected head.
In the normal fast-forward case the behavior remains unchanged.
However, now local modifications and commits will be erased, and
upstream rewrites are handled smoothly. This ensures that the upstream
branch is tested as expected.
Teach (create|run)_dashboard_script macros to treat the argument as the
name of a build tree. Append '.cmake' to generate the dashboard script
name. This allows future re-use of the macros for multiple test
scripts.
Git does not automatically checkout the matching version of a submodule
when it checks out a new version of the parent project in the work tree.
If the submodule reference changed in the parent project then we were
reporting the submodule path as a local modification. Work around the
problem in ctest_update using "git submodule update" after "git pull".
For projects with no submodules this is a no-op. See issue #10662.
Also add a submodule to the test project for CTest.UpdateGIT to test the
work-around.
We wrap the git executable in a shell script that touches one source
file after 'git pull'. This makes the file newer than the index even
though it has not actually changed. If CTest does not refresh the index
properly then the test will fail with a bogus modified file.
Part of this test does "git pull" on a dirty work tree. We need to make
sure that 'branch.master.rebase' is false for the test repository.
Otherwise if it is true in the user configuration then pull will refuse
to rebase and the test will fail.
This creates cmCTestGIT to drive CTest Update handling on git-based work
trees. Currently we always update to the head of the remote tracking
branch (git pull), so the nightly start time is ignored for Nightly
builds. A later change will address this. See issue #6994.