Page MenuHomePhabricator

[CMake] Update GetSVN.cmake to handle Repo

Authored by on Jul 18 2017, 12:42 AM.



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

clang version 6.0.0 (should be) --> clang version 6.0.0 (.../clang.git "clang's git hash on top") (.../llvm.git "llvm's git hash on top")

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.

Diff Detail


Event Timeline created this revision.Jul 18 2017, 12:42 AM edited the summary of this revision. (Show Details)Jul 20 2017, 2:21 AM edited the summary of this revision. (Show Details)Sep 5 2017, 3:52 AM

I have updated the description with a hope for it to be more descriptive.
Kindly ping~

probinson edited edge metadata.Sep 5 2017, 5:00 PM
probinson added subscribers: beanz, mehdi_amini.

The patch seems trivial enough but I do not have a good idea of the subtle differences in the various environments.
I have subscribed a couple of people who probably can tell whether this change makes sense.

rnk accepted this revision.Sep 5 2017, 5:14 PM
rnk added a subscriber: rnk.


This revision is now accepted and ready to land.Sep 5 2017, 5:14 PM
This revision was automatically updated to reflect the committed changes.