Skip to content

Commit

Permalink
Fix git read cache race condition
Browse files Browse the repository at this point in the history
Continue on error as same as no cache.
  • Loading branch information
gitfool committed Feb 6, 2024
1 parent 8490a53 commit 06626f6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/GitInfo/build/GitInfo.targets
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,12 @@
<Delete Files="$(_GitInfoFile)" />
</Target>

<Target Name="_GitReadCache" Condition="Exists('$(_GitInfoFile)') And '$(SkipReadGitCache)' != 'true' ">
<PropertyGroup>
<_GitCachedInfo>$([System.IO.File]::ReadAllText('$(_GitInfoFile)'))</_GitCachedInfo>
</PropertyGroup>
<Target Name="_GitReadCache" Condition="Exists('$(_GitInfoFile)') And '$(SkipReadGitCache)' != 'true'">
<ReadLinesFromFile File="$(_GitInfoFile)" ContinueOnError="true">
<Output TaskParameter="Lines" ItemName="_GitCachedInfo" />
</ReadLinesFromFile>

<CreateItem Include="GitInfo" AdditionalMetadata="$(_GitCachedInfo.Split(';'))">
<CreateItem Include="GitInfo" AdditionalMetadata="@(_GitCachedInfo -> TrimEnd(';'))">
<Output TaskParameter="Include" ItemName="GitInfo" />
</CreateItem>

Expand Down

0 comments on commit 06626f6

Please sign in to comment.