summaryrefslogtreecommitdiff
path: root/Tests/CTestUpdateGIT.sh.in
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-06-08 16:37:04 -0400
committerBrad King <brad.king@kitware.com>2010-06-08 16:50:17 -0400
commitc3781efb28a35f54ed6306354330734994f2c8b1 (patch)
tree3612ad00fb1dc19bf6e216fc19288c993f222765 /Tests/CTestUpdateGIT.sh.in
parent2eae651acc45c303008d9870a6a4f9da3d8bcf19 (diff)
downloadcmake-c3781efb28a35f54ed6306354330734994f2c8b1.tar.gz
ctest_update: Support Git upstream branch rewrites
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.
Diffstat (limited to 'Tests/CTestUpdateGIT.sh.in')
-rwxr-xr-xTests/CTestUpdateGIT.sh.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/Tests/CTestUpdateGIT.sh.in b/Tests/CTestUpdateGIT.sh.in
index 4761d3293e..e7586d6bfa 100755
--- a/Tests/CTestUpdateGIT.sh.in
+++ b/Tests/CTestUpdateGIT.sh.in
@@ -1,5 +1,5 @@
#!/bin/sh
-if test "x$1" = "xpull"; then
+if test "x$1" = "xpull" -o "x$1" = "xreset"; then
"@GIT@" "$@" && sleep 1 && touch foo.txt
else
exec "@GIT@" "$@"