GitInfo¶
Extract information from a git repository.
-
git_commit_info¶ Extract information about one commit from one git repository in
SOURCE DIR:git_commit_info([SOURCE DIR <dir>] [PREFIX <prefix>] [REVISION <rev>] [FATAL])
If
SOURCE_DIRis a git repository, it checks the givenREVISIONand sets the following variables:<PREFIX>_GIT_COMMIT_DESCRIBEThe output of
git describe <ref>.<PREFIX>_GIT_COMMIT_DESCRIBE_CONTAINSThe output of
git describe --contains <ref>.<PREFIX>_GIT_COMMIT_TAGThe most recent tag that is reachable from a commit.
<PREFIX>_GIT_COMMIT_REVISIONThe number of commits since the beginning of the git history.
<PREFIX>_GIT_COMMIT_TAG_REVISIONThe number of commits since the last tag.
<PREFIX>_GIT_COMMIT_DATE_REVISIONThe number of commits since the beginning of the day.
<PREFIX>_GIT_COMMIT_AUTHOR_DATEThe commit author date.
<PREFIX>_GIT_COMMIT_AUTHOR_TIMEThe commit author time.
<PREFIX>_GIT_COMMIT_AUTHOR_TZThe commit author time zone.
<PREFIX>_GIT_COMMIT_AUTHOR_NAMEThe commit author name.
<PREFIX>_GIT_COMMIT_AUTHOR_EMAILThe commit author e-mail.
<PREFIX>_GIT_COMMIT_COMMITTER_DATEThe commit committer date.
<PREFIX>_GIT_COMMIT_COMMITTER_TIMEThe commit author time.
<PREFIX>_GIT_COMMIT_COMMITTER_TZThe commit author time zone.
<PREFIX>_GIT_COMMIT_COMMITTER_NAMEThe commit committer name.
<PREFIX>_GIT_COMMIT_COMMITTER_EMAILThe commit committer email.
<PREFIX>_GIT_COMMIT_HASHThe commit hash.
<PREFIX>_GIT_COMMIT_HASH_SHORTThe abbreviated commit hash.
<PREFIX>_GIT_COMMIT_SUBJECTThe commit log message subject line.
<PREFIX>_GIT_COMMIT_BODYThe commit log message body.
If
SOURCE_DIRis not set, then thePROJECT_SOURCE_DIRcmake variable is used.If
PREFIXis not set, then thePROJECT_NAMEcmake variable is used.REVISIONcan be a commit hash, a tag, a branch, or anything that git can parse as a revision. IfREVISION` is not set, then ``HEADis used.If
FATALis set, a fatal error is emitted when the source dir is not a git repository, or when git was not found. This is disabled by default to allow downloads from non-git sources (archives, wrappers, etc.), but can be enabled if required.
-
git_wt_info¶ Extract information about current working tree from one git repository in
SOURCE DIR:git_wt_info([SOURCE DIR <dir>] [PREFIX <prefix>] [FATAL])
If
SOURCE_DIRis a git repository, it checks current revision and sets the following variables:<PREFIX>_GIT_WT_DESCRIBEThe output of
git describe HEAD.<PREFIX>_GIT_WT_DESCRIBE_CONTAINSThe output of
git describe --contains HEAD.<PREFIX>_GIT_WT_TAGThe most recent tag that is reachable from current commit.
<PREFIX>_GIT_WT_REVISIONThe number of commits since the beginning of the git history.
<PREFIX>_GIT_WT_TAG_REVISIONThe number of commits since the last tag.
<PREFIX>_GIT_WT_DATE_REVISIONThe number of commits since the beginning of the day.
<PREFIX>_GIT_WT_AUTHOR_DATEThe current commit author date.
<PREFIX>_GIT_WT_AUTHOR_TIMEThe current commit author time.
<PREFIX>_GIT_WT_AUTHOR_TZThe current commit author time zone.
<PREFIX>_GIT_WT_AUTHOR_NAMEThe current commit author name.
<PREFIX>_GIT_WT_AUTHOR_EMAILThe current commit author e-mail.
<PREFIX>_GIT_WT_COMMITTER_DATEThe current commit committer date.
<PREFIX>_GIT_WT_COMMITTER_TIMEThe current commit author time.
<PREFIX>_GIT_WT_COMMITTER_TZThe current commit author time zone.
<PREFIX>_GIT_WT_COMMITTER_NAMEThe current commit committer name.
<PREFIX>_GIT_WT_COMMITTER_EMAILThe current commit committer email.
<PREFIX>_GIT_WT_HASHThe current commit hash.
<PREFIX>_GIT_WT_HASH_SHORTThe abbreviated commit hash.
<PREFIX>_GIT_WT_SUBJECTThe current commit log message subject line.
<PREFIX>_GIT_WT_BODYThe current commit log message body.
<PREFIX>_GIT_WT_DIRTYWhether the current working tree is clean or not.
If
SOURCE_DIRis not set, then thePROJECT_SOURCE_DIRcmake variable is used.If
PREFIXis not set, then thePROJECT_NAMEcmake variable is used.If
FATALis set, a fatal error is emitted when the source dir is not a git repository, or when git was not found. This is disabled by default to allow downloads from non-git sources (archives, wrappers, etc.), but can be enabled if required.