From: Peter Collingbourne Date: Thu, 27 Apr 2017 17:04:05 +0000 (+0000) Subject: cmake: Touch $GIT_DIR/logs/HEAD if it does not already exist. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5cb8f643275d9766cbeac525e2dafda672ec7c3f;p=llvm cmake: Touch $GIT_DIR/logs/HEAD if it does not already exist. Apparently some git tools (such as "repo") may not create this file. Patch by Quentin Neill. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301565 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/CMakeLists.txt b/include/llvm/Support/CMakeLists.txt index b4b99370574..825052171cd 100644 --- a/include/llvm/Support/CMakeLists.txt +++ b/include/llvm/Support/CMakeLists.txt @@ -18,6 +18,10 @@ macro(find_first_existing_vc_file out_var path) if(git_result EQUAL 0) string(STRIP "${git_dir}" git_dir) set(${out_var} "${git_dir}/logs/HEAD") + # some branchless cases (e.g. 'repo') may not yet have .git/logs/HEAD + if (NOT EXISTS "${git_dir}/logs/HEAD") + file(WRITE "${git_dir}/logs/HEAD" "") + endif() else() find_first_existing_file(${out_var} "${path}/.svn/wc.db" # SVN 1.7