[llvm] r301565 - cmake: Touch $GIT_DIR/logs/HEAD if it does not already exist.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 10:04:05 PDT 2017


Author: pcc
Date: Thu Apr 27 12:04:05 2017
New Revision: 301565

URL: http://llvm.org/viewvc/llvm-project?rev=301565&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/Support/CMakeLists.txt

Modified: llvm/trunk/include/llvm/Support/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CMakeLists.txt?rev=301565&r1=301564&r2=301565&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CMakeLists.txt (original)
+++ llvm/trunk/include/llvm/Support/CMakeLists.txt Thu Apr 27 12:04:05 2017
@@ -18,6 +18,10 @@ macro(find_first_existing_vc_file out_va
   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




More information about the llvm-commits mailing list