Skip to content

Commit 0384446

Browse files
pdhaliwal-amdssahasra
authored andcommitted
Remove SVN logic from find_first_existing_vc_file
As LLVM has moved from SVN to git, there is no need to keep SVN related code. Also, this code piece was never used. Differential Revision: https://reviews.llvm.org/D79400
1 parent cf6cc66 commit 0384446

File tree

1 file changed

+19
-32
lines changed

1 file changed

+19
-32
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,40 +2094,27 @@ function(find_first_existing_vc_file path out_var)
20942094
if(NOT EXISTS "${path}")
20952095
return()
20962096
endif()
2097-
if(EXISTS "${path}/.svn")
2098-
set(svn_files
2099-
"${path}/.svn/wc.db" # SVN 1.7
2100-
"${path}/.svn/entries" # SVN 1.6
2101-
)
2102-
foreach(file IN LISTS svn_files)
2103-
if(EXISTS "${file}")
2104-
set(${out_var} "${file}" PARENT_SCOPE)
2105-
return()
2106-
endif()
2107-
endforeach()
2108-
else()
2109-
find_package(Git)
2110-
if(GIT_FOUND)
2111-
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir
2112-
WORKING_DIRECTORY ${path}
2113-
RESULT_VARIABLE git_result
2114-
OUTPUT_VARIABLE git_output
2115-
ERROR_QUIET)
2116-
if(git_result EQUAL 0)
2117-
string(STRIP "${git_output}" git_output)
2118-
get_filename_component(git_dir ${git_output} ABSOLUTE BASE_DIR ${path})
2119-
# Some branchless cases (e.g. 'repo') may not yet have .git/logs/HEAD
2120-
if (NOT EXISTS "${git_dir}/logs/HEAD")
2121-
execute_process(COMMAND ${CMAKE_COMMAND} -E touch HEAD
2122-
WORKING_DIRECTORY "${git_dir}/logs"
2123-
RESULT_VARIABLE touch_head_result
2124-
ERROR_QUIET)
2125-
if (NOT touch_head_result EQUAL 0)
2126-
return()
2127-
endif()
2097+
find_package(Git)
2098+
if(GIT_FOUND)
2099+
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir
2100+
WORKING_DIRECTORY ${path}
2101+
RESULT_VARIABLE git_result
2102+
OUTPUT_VARIABLE git_output
2103+
ERROR_QUIET)
2104+
if(git_result EQUAL 0)
2105+
string(STRIP "${git_output}" git_output)
2106+
get_filename_component(git_dir ${git_output} ABSOLUTE BASE_DIR ${path})
2107+
# Some branchless cases (e.g. 'repo') may not yet have .git/logs/HEAD
2108+
if (NOT EXISTS "${git_dir}/logs/HEAD")
2109+
execute_process(COMMAND ${CMAKE_COMMAND} -E touch HEAD
2110+
WORKING_DIRECTORY "${git_dir}/logs"
2111+
RESULT_VARIABLE touch_head_result
2112+
ERROR_QUIET)
2113+
if (NOT touch_head_result EQUAL 0)
2114+
return()
21282115
endif()
2129-
set(${out_var} "${git_dir}/logs/HEAD" PARENT_SCOPE)
21302116
endif()
2117+
set(${out_var} "${git_dir}/logs/HEAD" PARENT_SCOPE)
21312118
endif()
21322119
endif()
21332120
endfunction()

0 commit comments

Comments
 (0)