Skip to content

Commit

Permalink
improvements to the GIT status
Browse files Browse the repository at this point in the history
  • Loading branch information
Hefaistos68 committed Sep 6, 2023
1 parent bce2ef6 commit 33c1e3f
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 7 deletions.
4 changes: 2 additions & 2 deletions VSLauncherX/Helpers/ColumnHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@ internal static CheckState SetCheckState(object rowObject, CheckState newValue)
}
if (s.Status == "*")
{
return Resources.GitDirty;
return Resources.GitDirty2;
}
else if (s.Status == "!")
{
return Resources.GitClean;
return Resources.GitClean2;
}
}

Expand Down
22 changes: 17 additions & 5 deletions VSLauncherX/MainDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ private void MainDialog_Load(object sender, EventArgs e)

SetupTaskbarTasks();

FetchGitStatus(this.solutionGroups);

_ = this.txtFilter.Focus();
}

Expand All @@ -270,8 +268,21 @@ private void FetchGitStatus(VsFolder folder)
}
catch (RepositoryNotFoundException ex)
{
// this is not a GIT repository
item.Status = "?";
// retry with the parent folder
try
{
using (var repo = new Repository(Path.GetDirectoryName(Path.GetDirectoryName(item.Path))))
{
var stat = repo.RetrieveStatus();
item.Status = stat.IsDirty ? "*" : "!";
}
}
catch (RepositoryNotFoundException ex2)
{
// this is not a GIT repository
item.Status = "?";

}
}
}
else
Expand Down Expand Up @@ -548,6 +559,7 @@ private void mainRefresh_Click(object sender, EventArgs e)
this.solutionGroups.Items.OnChanged += SolutionData_OnChanged;

UpdateList();
FetchGitStatus(this.solutionGroups);
}

/// <summary>
Expand Down Expand Up @@ -1285,7 +1297,7 @@ private void UpdateList()
this.olvFiles.SetObjects(this.solutionGroups.Items);

IterateAndExpandItems();
// this.olvFiles.ExpandAll();
FetchGitStatus(this.solutionGroups);
}

private void IterateAndExpandItems()
Expand Down
20 changes: 20 additions & 0 deletions VSLauncherX/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions VSLauncherX/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,10 @@
<data name="GitDirty" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Images\GitDirty.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="GitClean2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Images\GitClean2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="GitDirty2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Images\GitDirty2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file added VSLauncherX/Resources/Images/GitClean2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added VSLauncherX/Resources/Images/GitDirty2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 33c1e3f

Please sign in to comment.