Skip to content

Commit

Permalink
Optimize if statement perf
Browse files Browse the repository at this point in the history
  • Loading branch information
dkbennett committed Nov 14, 2023
1 parent 9d47fbb commit 0440838
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AzureExtension/Client/AzureUri.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ private string InitializeProject()
// There is a special situation with Repository URLs where the project name is omitted
// if the repository is the same name as the project. In this situation the segment
// immediately preceding the _git segment must be the organization segment.
if (APISegment.Equals("_git", StringComparison.OrdinalIgnoreCase)
if ((APISegmentIndex == (2 + hostTypeOffset))
&& (Uri!.Segments.Length > (APISegmentIndex + 1))
&& (APISegmentIndex == (2 + hostTypeOffset)))
&& APISegment.Equals("_git", StringComparison.OrdinalIgnoreCase))
{
// The target segment is the repository name.
targetSegment = APISegmentIndex + 1;
Expand Down

0 comments on commit 0440838

Please sign in to comment.