summaryrefslogtreecommitdiffstats
path: root/Source/CTest
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-02-09 18:31:32 (GMT)
committerBrad King <brad.king@kitware.com>2010-02-09 18:31:32 (GMT)
commit8bd231866afcae6aa8edb2d9df5f574bb017c0ed (patch)
tree7263e7004eccd0bf102e2fdb04a8f977908a1636 /Source/CTest
parent78a5727d493343177be4bbf6ed0caefbdf0be3fb (diff)
downloadCMake-8bd231866afcae6aa8edb2d9df5f574bb017c0ed.zip
CMake-8bd231866afcae6aa8edb2d9df5f574bb017c0ed.tar.gz
CMake-8bd231866afcae6aa8edb2d9df5f574bb017c0ed.tar.bz2
cmCTestGIT: Refresh index for local modifications
We use 'git diff-index' to detect local modifications after pull. On some filesystems the work tree timestamps of a few files may be dated after the index, making them appear as locally modified. We address the problem by using 'git update-index --refresh' to refresh the index and avoid false local modifications.
Diffstat (limited to 'Source/CTest')
-rw-r--r--Source/CTest/cmCTestGIT.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx
index 8108b19..6d5bf65 100644
--- a/Source/CTest/cmCTestGIT.cxx
+++ b/Source/CTest/cmCTestGIT.cxx
@@ -409,10 +409,16 @@ void cmCTestGIT::LoadRevisions()
//----------------------------------------------------------------------------
void cmCTestGIT::LoadModifications()
{
- // Use 'git diff-index' to get modified files.
const char* git = this->CommandLineTool.c_str();
- const char* git_diff_index[] = {git, "diff-index", "-z", "HEAD", 0};
+ // Use 'git update-index' to refresh the index w.r.t. the work tree.
+ const char* git_update_index[] = {git, "update-index", "--refresh", 0};
+ OutputLogger ui_out(this->Log, "ui-out> ");
+ OutputLogger ui_err(this->Log, "ui-err> ");
+ this->RunChild(git_update_index, &ui_out, &ui_err);
+
+ // Use 'git diff-index' to get modified files.
+ const char* git_diff_index[] = {git, "diff-index", "-z", "HEAD", 0};
DiffParser out(this, "di-out> ");
OutputLogger err(this->Log, "di-err> ");
this->RunChild(git_diff_index, &out, &err);