Skip to content

Commit ffeb636

Browse files
committed
fix: ignoring new files under folder creates invalid .gitignore entries (#663)
Signed-off-by: leo <[email protected]>
1 parent 243ce8b commit ffeb636

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ViewModels/WorkingCopy.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ public ContextMenu CreateContextMenuForUnstagedChanges()
599599
byParentFolder.IsVisible = !isRooted;
600600
byParentFolder.Click += (_, e) =>
601601
{
602-
Commands.GitIgnore.Add(_repo.FullPath, Path.GetDirectoryName(change.Path) + "/");
602+
var path = Path.GetDirectoryName(change.Path).Replace("\\", "/");
603+
Commands.GitIgnore.Add(_repo.FullPath, path + "/");
603604
e.Handled = true;
604605
};
605606
addToIgnore.Items.Add(byParentFolder);
@@ -620,7 +621,8 @@ public ContextMenu CreateContextMenuForUnstagedChanges()
620621
byExtensionInSameFolder.IsVisible = !isRooted;
621622
byExtensionInSameFolder.Click += (_, e) =>
622623
{
623-
Commands.GitIgnore.Add(_repo.FullPath, Path.GetDirectoryName(change.Path) + "/*" + extension);
624+
var path = Path.GetDirectoryName(change.Path).Replace("\\", "/");
625+
Commands.GitIgnore.Add(_repo.FullPath, path + "/*" + extension);
624626
e.Handled = true;
625627
};
626628
addToIgnore.Items.Add(byExtensionInSameFolder);

0 commit comments

Comments
 (0)