Skip to content

Commit 1e6cea5

Browse files
committed
Convert to ?: operator
1 parent ec22983 commit 1e6cea5

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

GitDiffMargin/EditorDiffMargin.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ private void UpdateDiffDimensions(DiffViewModel diffViewModel, HunkRangeInfo hun
3333
if (TextView.IsClosed)
3434
return;
3535

36-
bool? visible;
37-
if (diffViewModel.IsDeletion)
38-
visible = UpdateDeletedDiffDimensions(diffViewModel, hunkRangeInfo);
39-
else
40-
visible = UpdateNormalDiffDimensions(diffViewModel, hunkRangeInfo);
36+
var visible = diffViewModel.IsDeletion ? UpdateDeletedDiffDimensions(diffViewModel, hunkRangeInfo) : UpdateNormalDiffDimensions(diffViewModel, hunkRangeInfo);
4137

4238
if (visible.HasValue)
4339
diffViewModel.IsVisible = visible.Value;

GitDiffMargin/Git/GitCommands.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel.Composition;
44
using System.IO;
@@ -162,12 +162,8 @@ public void StartExternalDiff(ITextDocument textDocument, string originalPath)
162162
if (indexEntry != null)
163163
{
164164
// determine if the file has been staged
165-
string revision;
166165
var stagedMask = FileStatus.NewInIndex | FileStatus.ModifiedInIndex;
167-
if ((repo.RetrieveStatus(relativePath) & stagedMask) != 0)
168-
revision = "index";
169-
else
170-
revision = repo.Head.Tip.Sha.Substring(0, 7);
166+
var revision = (repo.RetrieveStatus(relativePath) & stagedMask) != 0 ? "index" : repo.Head.Tip.Sha.Substring(0, 7);
171167

172168
leftLabel = string.Format("{0}@{1}", objectName, revision);
173169
}

0 commit comments

Comments
 (0)