Skip to content

Commit fce5d8d

Browse files
committed
Undo works
1 parent 18232cd commit fce5d8d

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

Rubberduck.SourceControl/GitProvider.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ public override void Undo(string filePath)
469469
{
470470
try
471471
{
472-
_repo.CheckoutPaths(CurrentBranch.Name, new List<string> {filePath});
472+
var tip = _repo.Branches.First(b => !b.IsRemote && b.IsCurrentRepositoryHead).Tip;
473+
var options = new CheckoutOptions { CheckoutModifiers = CheckoutModifiers.Force };
474+
_repo.CheckoutPaths(tip.Sha, new List<string> { filePath }, options);
473475
base.Undo(filePath);
474476
}
475477
catch (LibGit2SharpException ex)

Rubberduck.SourceControl/SourceControlProviderBase.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ public virtual void Checkout(string branch)
101101

102102
public virtual void Undo(string filePath)
103103
{
104-
//this might need to cherry pick from the tip instead.
105-
106-
var componentName = Path.GetFileNameWithoutExtension(filePath);
104+
var componentName = Path.GetFileNameWithoutExtension(filePath);
107105

108106
//GetFileNameWithoutExtension returns empty string if it's not a file
109107
//https://msdn.microsoft.com/en-us/library/system.io.path.getfilenamewithoutextension%28v=vs.110%29.aspx

Rubberduck.VBEEditor/Extensions/VBComponentExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Rubberduck.VBEditor.Extensions
55
{
66
public static class VBComponentExtensions
77
{
8-
internal const string ClassExtesnion = ".cls";
8+
internal const string ClassExtension = ".cls";
99
internal const string FormExtension = ".frm";
1010
internal const string StandardExtension = ".bas";
1111
internal const string FormBinaryExtension = ".frx";
@@ -46,7 +46,7 @@ public static string FileExtension(this vbext_ComponentType componentType)
4646
switch (componentType)
4747
{
4848
case vbext_ComponentType.vbext_ct_ClassModule:
49-
return ClassExtesnion;
49+
return ClassExtension;
5050
case vbext_ComponentType.vbext_ct_MSForm:
5151
return FormExtension;
5252
case vbext_ComponentType.vbext_ct_StdModule:

Rubberduck.VBEEditor/Extensions/VbProjectExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void ImportSourceFiles(this VBProject project, string filePath)
5959

6060
var files = dirInfo.EnumerateFiles()
6161
.Where(f => f.Extension == VBComponentExtensions.StandardExtension ||
62-
f.Extension == VBComponentExtensions.ClassExtesnion ||
62+
f.Extension == VBComponentExtensions.ClassExtension ||
6363
f.Extension == VBComponentExtensions.DocClassExtension ||
6464
f.Extension == VBComponentExtensions.FormExtension
6565
);

0 commit comments

Comments
 (0)