diff options
author | Brad King <brad.king@kitware.com> | 2021-01-18 16:20:39 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-01-18 16:20:45 (GMT) |
commit | 54dbc9c8f7c57192b2e2e7a9aa48cead672d898d (patch) | |
tree | ff30a602229272136afa408ccbc744c2a8937a3a | |
parent | 2f047081fb026901cfaa9ad49c0b3f6f5c5db088 (diff) | |
parent | ac4a8002a596b00261b148828918926140c520b4 (diff) | |
download | CMake-54dbc9c8f7c57192b2e2e7a9aa48cead672d898d.zip CMake-54dbc9c8f7c57192b2e2e7a9aa48cead672d898d.tar.gz CMake-54dbc9c8f7c57192b2e2e7a9aa48cead672d898d.tar.bz2 |
Merge topic 'ep-stash-options'
ac4a8002a5 ExternalProject: Don't git stash ignored files
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5390
-rw-r--r-- | Modules/ExternalProject.cmake | 11 | ||||
-rw-r--r-- | Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake | 22 | ||||
-rw-r--r-- | Tests/ExternalProjectUpdate/gitrepo.tgz | bin | 3057 -> 3397 bytes |
3 files changed, 24 insertions, 9 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 3307bc6..bb3684a 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1422,10 +1422,13 @@ function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_r if("${git_tag}" STREQUAL "") message(FATAL_ERROR "Tag for git checkout should not be empty.") endif() - if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6) - set(git_stash_save_options --all --quiet) - else() - set(git_stash_save_options --quiet) + set(git_stash_save_options --quiet) + if(GIT_VERSION_STRING VERSION_GREATER_EQUAL 1.7.7) + # This avoids stashing files covered by .gitignore + list(APPEND git_stash_save_options --include-untracked) + elseif(GIT_VERSION_STRING VERSION_GREATER_EQUAL 1.7.6) + # Untracked files, but also ignored files, so potentially slower + list(APPEND git_stash_save_options --all) endif() configure_file( diff --git a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake index ddc513f..d300e8b 100644 --- a/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake +++ b/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake @@ -185,17 +185,17 @@ endif() file(REMOVE_RECURSE ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals) if(do_git_tests) - check_a_tag(origin/master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 REBASE) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 REBASE) check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 1 REBASE) - # With the Git UPDATE_COMMAND performance patch, this will not required a + # With the Git UPDATE_COMMAND performance patch, this will not require a # 'git fetch' check_a_tag(tag1 d1970730310fe8bc07e73f15dc570071f9f9654a 0 REBASE) check_a_tag(tag2 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 REBASE) check_a_tag(d19707303 d1970730310fe8bc07e73f15dc570071f9f9654a 1 REBASE) check_a_tag(d19707303 d1970730310fe8bc07e73f15dc570071f9f9654a 0 REBASE) - check_a_tag(origin/master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 REBASE) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 REBASE) # This is a remote symbolic ref, so it will always trigger a 'git fetch' - check_a_tag(origin/master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 REBASE) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 REBASE) foreach(strategy IN ITEMS CHECKOUT REBASE_CHECKOUT) # Move local master back, then apply a change that will cause a conflict @@ -229,7 +229,19 @@ if(do_git_tests) message(FATAL_ERROR "Could not commit conflicting change.") endif() # This should discard our commit but leave behind an annotated tag - check_a_tag(origin/master 5842b503ba4113976d9bb28d57b5aee1ad2736b7 1 ${strategy}) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 ${strategy}) endforeach() + # This file matches a .gitignore rule that the last commit defines. We can't + # directly check that updates don't stash ignored contents because the stash + # and pop are both done within the update step. We don't have an opportunity + # to check things in between, but we can at least check that the update step + # doesn't choke on it. + set(ignoredFile ${ExternalProjectUpdate_BINARY_DIR}/CMakeExternals/Source/TutorialStep1-GIT/ignored_item) + file(TOUCH ${ignoredFile}) + check_a_tag(origin/master b5752a26ae448410926b35c275af3c192a53722e 1 REBASE) + if(NOT EXISTS ${ignoredFile}) + message(FATAL_ERROR "Ignored file is missing") + endif() + endif() diff --git a/Tests/ExternalProjectUpdate/gitrepo.tgz b/Tests/ExternalProjectUpdate/gitrepo.tgz Binary files differindex 87090ab..4dab56b 100644 --- a/Tests/ExternalProjectUpdate/gitrepo.tgz +++ b/Tests/ExternalProjectUpdate/gitrepo.tgz |