Skip to content

Commit 7929ea0

Browse files
author
Samir L. Boulema
committed
Read gitdir file: VS2019 - Switching solutions disables TGIT #59
1 parent 5575afb commit 7929ea0

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

TGit/Commands/ContextMenuCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private void RevGraphContextCommand(object sender, EventArgs e)
7474
private void BlameContextCommand(object sender, EventArgs e)
7575
{
7676
var currentFilePath = _dte.ActiveDocument.FullName;
77-
int currentLineIndex = ((TextDocument)_dte.ActiveDocument.Object(string.Empty)).Selection.CurrentLine;
77+
var currentLineIndex = ((TextDocument)_dte.ActiveDocument.Object(string.Empty)).Selection.CurrentLine;
7878
if (string.IsNullOrEmpty(currentFilePath)) return;
7979
if (!_dte.ActiveDocument.Saved)
8080
_dte.ActiveDocument.Save();

TGit/Helpers/FileHelper.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,17 @@ private static string FindGitdir(string path)
8181
var match = Regex.Match(text, "gitdir:(.*)");
8282
if (match.Success)
8383
{
84-
return match.Groups[1].Value.Trim();
84+
var gitDirPath = match.Groups[1].Value.Trim();
85+
86+
if (Directory.Exists(gitDirPath))
87+
{
88+
return gitDirPath;
89+
}
90+
91+
if (File.Exists(gitDirPath))
92+
{
93+
return File.ReadAllText(gitDirPath);
94+
}
8595
}
8696
}
8797

TGit/Helpers/ProcessHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System;
33
using System.Diagnostics;
44
using System.Drawing;
5+
using System.Threading.Tasks;
56
using System.Windows.Forms;
67
using Process = System.Diagnostics.Process;
78

@@ -60,7 +61,7 @@ public static void StartTortoiseGitProc(EnvHelper envHelper, string args)
6061
var tortoiseGitProc = envHelper.GetTortoiseGitProc();
6162
try
6263
{
63-
Process.Start(tortoiseGitProc, args);
64+
var task = Task.Run(() => Process.Start(tortoiseGitProc, args));
6465
}
6566
catch (Exception e)
6667
{

0 commit comments

Comments
 (0)