Skip to content

Commit 67d914f

Browse files
authored
Merge pull request #504 from Sichao25/yus/cdash
Debug `remove_branch_if_exists` in nightly script
2 parents ceab906 + d7a89fa commit 67d914f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cdash/nightly.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ endfunction(git_exec)
9494

9595
function(remove_branch_if_exists BRANCH_NAME)
9696
message("Attempting to delete ${BRANCH_NAME} if it exists")
97-
execute_process(COMMAND "${CTEST_GIT_COMMAND}" branch --list ${BRANCH_NAME}
97+
execute_process(COMMAND "${CTEST_GIT_COMMAND}" show-ref --quiet refs/heads/${BRANCH_NAME}
9898
WORKING_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/${CTEST_PROJECT_NAME}"
9999
RESULT_VARIABLE BRANCH_RET)
100-
message("git branch --list returned: ${BRANCH_RET})!")
101-
if(BRANCH_RET)
100+
message("git branch --list returned: ${BRANCH_RET}!")
101+
if(NOT BRANCH_RET)
102102
message("${BRANCH_NAME} exists. Attempting to delete it.")
103103
git_exec("branch -D ${BRANCH_NAME}" "Deleted ${BRANCH_NAME}.")
104104
endif()

0 commit comments

Comments
 (0)