Skip to content

Commit

Permalink
Read gitdir file: VS2019 - Switching solutions disables TGIT #59
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir L. Boulema committed Jan 9, 2020
1 parent 5575afb commit 7929ea0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TGit/Commands/ContextMenuCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void RevGraphContextCommand(object sender, EventArgs e)
private void BlameContextCommand(object sender, EventArgs e)
{
var currentFilePath = _dte.ActiveDocument.FullName;
int currentLineIndex = ((TextDocument)_dte.ActiveDocument.Object(string.Empty)).Selection.CurrentLine;
var currentLineIndex = ((TextDocument)_dte.ActiveDocument.Object(string.Empty)).Selection.CurrentLine;
if (string.IsNullOrEmpty(currentFilePath)) return;
if (!_dte.ActiveDocument.Saved)
_dte.ActiveDocument.Save();
Expand Down
12 changes: 11 additions & 1 deletion TGit/Helpers/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,17 @@ private static string FindGitdir(string path)
var match = Regex.Match(text, "gitdir:(.*)");
if (match.Success)
{
return match.Groups[1].Value.Trim();
var gitDirPath = match.Groups[1].Value.Trim();

if (Directory.Exists(gitDirPath))
{
return gitDirPath;
}

if (File.Exists(gitDirPath))
{
return File.ReadAllText(gitDirPath);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion TGit/Helpers/ProcessHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
using Process = System.Diagnostics.Process;

Expand Down Expand Up @@ -60,7 +61,7 @@ public static void StartTortoiseGitProc(EnvHelper envHelper, string args)
var tortoiseGitProc = envHelper.GetTortoiseGitProc();
try
{
Process.Start(tortoiseGitProc, args);
var task = Task.Run(() => Process.Start(tortoiseGitProc, args));
}
catch (Exception e)
{
Expand Down

0 comments on commit 7929ea0

Please sign in to comment.