[PATCH] D31985: Support: Add a VCSRevision.h header file.

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


pcc added a comment.

In https://reviews.llvm.org/D31985#737643, @qneill2014 wrote:

> In https://reviews.llvm.org/D31985#734032, @pcc wrote:
>
> > Actually, I think that won't work because it looks like `.git/HEAD` does not get updated if a commit is made on a branch.
>
>
> Hmm, you are right, because .git/HEAD holds a ref
>
> > An alternative solution would be to touch `.git/logs/HEAD` if it does not exist.
>
> I checked and this seems to work, it doesn't seem to affect our typical usage ('repo init' ... 'repo sync').
>
> To answer your other question, I haven't committed anything for a couple of years, so practically I don't have commit access; please submit a patch
>
> FWIW I am testing this locally to see if anything else pops up:
>
>   diff --git a/include/llvm/Support/CMakeLists.txt b/include/llvm/Support/CMakeLists.txt
>   index b4b9937..41e2668 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
>  
>


Thanks, I have committed your patch as r301565.


Repository:
  rL LLVM

https://reviews.llvm.org/D31985





More information about the llvm-commits mailing list