[llvm] r312864 - [CMake] Update GetSVN.cmake to handle repo

MinSeong Kim via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 9 07:17:52 PDT 2017


Author: minseongkim
Date: Sat Sep  9 07:17:52 2017
New Revision: 312864

URL: http://llvm.org/viewvc/llvm-project?rev=312864&view=rev
Log:
[CMake] Update GetSVN.cmake to handle repo

Summary:
When repo is used with git, 'clang --version' option does not display
the correct revision information (i.e. git hash on TOP) as the following:

clang version 6.0.0 --->
clang version 6.0.0 (clang version) (llvm version)

This is because repo also creates .git/svn folder as git-svn does and
this makes repo with git uses "git svn info" command, which is only for
git-svn, to retrieve its revision information, making null for the info.
To correctly distinguish between git-svn and repo with git, the folder
hierarchy to specify for git-svn should be .git/svn/refs as the "git svn
info" command depends on the revision data in .git/svn/refs. This patch
in turn makes repo with git passes through to the third macro,
get_source_info_git, in  get_source_info function, resulting in correctly
retrieving the revision information for repo with git using "git log ..."
command.

This patch is tested with git, svn, git-svn, and repo with git.

Reviewers: llvm-commits, probinson, rnk

Reviewed By: rnk

Subscribers: rnk, mehdi_amini, beanz, mgorny

Differential Revision: https://reviews.llvm.org/D35532

Modified:
    llvm/trunk/cmake/modules/GetSVN.cmake

Modified: llvm/trunk/cmake/modules/GetSVN.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/GetSVN.cmake?rev=312864&r1=312863&r2=312864&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/GetSVN.cmake (original)
+++ llvm/trunk/cmake/modules/GetSVN.cmake Sat Sep  9 07:17:52 2017
@@ -84,7 +84,7 @@ endmacro()
 function(get_source_info path revision repository)
   if (EXISTS "${path}/.svn")
     get_source_info_svn("${path}" revision repository)
-  elseif (EXISTS "${path}/.git/svn")
+  elseif (EXISTS "${path}/.git/svn/refs")
     get_source_info_git_svn("${path}" revision repository)
   elseif (EXISTS "${path}/.git")
     get_source_info_git("${path}" revision repository)




More information about the llvm-commits mailing list