Skip to content

Commit

Permalink
fixed bad status computation: take intro account index & worktree del…
Browse files Browse the repository at this point in the history
…eted files
franck-gaspoz committed Feb 18, 2021
1 parent ebcfacc commit fcc0fe3
Showing 2 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions Prompt-Git-Info.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31005.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prompt-Git-Info", "Prompt-Git-Info.csproj", "{3989FA7B-D89D-44F1-815F-D029793C8A78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3989FA7B-D89D-44F1-815F-D029793C8A78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3989FA7B-D89D-44F1-815F-D029793C8A78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3989FA7B-D89D-44F1-815F-D029793C8A78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3989FA7B-D89D-44F1-815F-D029793C8A78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C5DD6B4D-74E3-4DEB-B7D3-38E0B039BAEE}
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions RepoInfo.cs
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@ public void Update()
Behind = X['↑'];
Ahead = X['↓'];
RepoStatus = RepoStatus.UpToDate;
if ((IndexChanges > 0 || WorktreeChanges > 0) && Untracked==0) RepoStatus = RepoStatus.Modified;
if ((IndexChanges > 0 || WorktreeChanges > 0) && Untracked>0) RepoStatus = RepoStatus.ModifiedUntracked;
if ((IndexChanges > 0 || WorktreeChanges > 0 || WorktreeDeleted>0 || IndexDeleted>0) && Untracked==0) RepoStatus = RepoStatus.Modified;
if ((IndexChanges > 0 || WorktreeChanges > 0 || WorktreeDeleted > 0 || IndexDeleted > 0) && Untracked>0) RepoStatus = RepoStatus.ModifiedUntracked;
if (Behind > 0) RepoStatus = RepoStatus.Behind;
if (Ahead > 0) RepoStatus = RepoStatus.Ahead;
if (Ahead > 0 && Behind > 0) RepoStatus = RepoStatus.AheadBehind;

0 comments on commit fcc0fe3

Please sign in to comment.