From 0440838e82e90920bae6033f009daf22d12f53d4 Mon Sep 17 00:00:00 2001 From: David Bennett Date: Mon, 13 Nov 2023 20:39:49 -0800 Subject: [PATCH] Optimize if statement perf --- src/AzureExtension/Client/AzureUri.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AzureExtension/Client/AzureUri.cs b/src/AzureExtension/Client/AzureUri.cs index 064b24e0..2cf28f7b 100644 --- a/src/AzureExtension/Client/AzureUri.cs +++ b/src/AzureExtension/Client/AzureUri.cs @@ -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;