Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/GitInfo/build/GitInfo.targets
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
will be used to find a base version.
Defaults to empty value (no ignoring).

$(GitNameRevOptions): Options passed to git name-rev when finding
a branch name for a commit (Detached head).
The default is '--refs=refs/heads/*'
meaning branch names only. For the legacy behavior where
$(GitBranch) for detached head can also be a tag name,
use '--refs=refs/*'.
Refs can be included and excluded, see git name-rev docs.

$(GitSkipCache): whether to cache the Git information determined
in a previous build in a GitInfo.cache for
performance reasons.
Expand Down Expand Up @@ -92,6 +100,8 @@

<GitCommitsIgnoreMerges Condition="'$(GitCommitsIgnoreMerges)' == ''">false</GitCommitsIgnoreMerges>

<GitNameRevOptions Condition="'$(GitNameRevOptions)' == ''">--refs=refs/heads/*</GitNameRevOptions>

<GitMinVersion>2.5.0</GitMinVersion>
</PropertyGroup>

Expand Down Expand Up @@ -428,7 +438,7 @@
</PropertyGroup>

<!-- CI systems may checkout the specific commit, rather than the branch, so we need to fallback -->
<Exec Command='$(GitExe) name-rev --name-only HEAD'
<Exec Command='$(GitExe) name-rev --name-only $(GitNameRevOptions) HEAD'
Condition=" '$(GitBranch)' == '' "
EchoOff='true'
StandardErrorImportance="low"
Expand Down
13 changes: 13 additions & 0 deletions src/GitInfo/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,16 @@ Available MSBuild customizations:
whether the branch and tags (if any)
will be used to find a base version.
Defaults to empty value (no ignoring).

$(GitNameRevOptions): Options passed to git name-rev when finding
a branch name for the current commit (Detached head).
The default is '--refs=refs/heads/*'
meaning branch names only. For legacy behavior where
$(GitBranch) for detached head can also be a tag name,
use '--refs=refs/*'.
Refs can be included and excluded, see git name-rev docs.

$(GitSkipCache): whether to cache the Git information determined
in a previous build in a GitInfo.cache for
performance reasons.
Defaults to empty value (no ignoring).