Skip to content

Commit

Permalink
Convert to ?: operator
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentkempe committed Aug 25, 2018
1 parent ec22983 commit 1e6cea5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
6 changes: 1 addition & 5 deletions GitDiffMargin/EditorDiffMargin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ private void UpdateDiffDimensions(DiffViewModel diffViewModel, HunkRangeInfo hun
if (TextView.IsClosed)
return;

bool? visible;
if (diffViewModel.IsDeletion)
visible = UpdateDeletedDiffDimensions(diffViewModel, hunkRangeInfo);
else
visible = UpdateNormalDiffDimensions(diffViewModel, hunkRangeInfo);
var visible = diffViewModel.IsDeletion ? UpdateDeletedDiffDimensions(diffViewModel, hunkRangeInfo) : UpdateNormalDiffDimensions(diffViewModel, hunkRangeInfo);

This comment has been minimized.

Copy link
@sharwell

sharwell Aug 25, 2018

Collaborator

💭 this isn't wrong, but it's also not better IMO


if (visible.HasValue)
diffViewModel.IsVisible = visible.Value;
Expand Down
8 changes: 2 additions & 6 deletions GitDiffMargin/Git/GitCommands.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO;
Expand Down Expand Up @@ -162,12 +162,8 @@ public void StartExternalDiff(ITextDocument textDocument, string originalPath)
if (indexEntry != null)
{
// determine if the file has been staged
string revision;
var stagedMask = FileStatus.NewInIndex | FileStatus.ModifiedInIndex;
if ((repo.RetrieveStatus(relativePath) & stagedMask) != 0)
revision = "index";
else
revision = repo.Head.Tip.Sha.Substring(0, 7);
var revision = (repo.RetrieveStatus(relativePath) & stagedMask) != 0 ? "index" : repo.Head.Tip.Sha.Substring(0, 7);

This comment has been minimized.

Copy link
@sharwell

sharwell Aug 25, 2018

Collaborator

💭 this isn't wrong, but it's also not better IMO


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

0 comments on commit 1e6cea5

Please sign in to comment.