Skip to content

Commit 314d1b2

Browse files
committed
correct back git commands for prune and branch listing, improved settings ui
1 parent 9a45714 commit 314d1b2

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

GitWorkTree/Helpers/GitHelper.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ private static async Task<bool> ExecuteAsync(GitCommandArgs gitCommandArgs, Acti
3232
if (gitCommandArgs == null || string.IsNullOrEmpty(gitCommandArgs.WorkingDirectory))
3333
{
3434
outputWindow?.WriteToOutputWindowAsync("The working directory is invalid or not loaded yet");
35-
return false;
35+
return false;
3636
}
3737

3838
if (!File.Exists(GitPath))
3939
{
4040
outputWindow?.WriteToOutputWindowAsync($"Git executable not found at: {GitPath}", true);
41-
return false;
41+
return false;
4242
}
4343

4444
outputWindow?.WriteToOutputWindowAsync($"Executing Git command: {gitCommandArgs.Argument}", true);
@@ -48,7 +48,7 @@ private static async Task<bool> ExecuteAsync(GitCommandArgs gitCommandArgs, Acti
4848
var startInfo = new ProcessStartInfo
4949
{
5050
FileName = GitPath,
51-
Arguments = $"--no-pager --no-color {gitCommandArgs.Argument}",
51+
Arguments = gitCommandArgs.Argument,
5252
WorkingDirectory = gitCommandArgs.WorkingDirectory,
5353
UseShellExecute = false,
5454
CreateNoWindow = true,
@@ -131,7 +131,7 @@ public static async Task<List<string>> GetBranchesAsync(string repositoryPath)
131131
var isCompleted = await ExecuteAsync(new GitCommandArgs()
132132
{
133133
WorkingDirectory = repositoryPath,
134-
Argument = "branch -a"
134+
Argument = "--no-pager branch -a --no-color"
135135
}, (line) =>
136136
{
137137
if (!string.IsNullOrWhiteSpace(line))
@@ -175,7 +175,7 @@ public static async Task<bool> PruneAsync(string repositoryPath)
175175
{
176176
return await ExecuteAsync(new GitCommandArgs()
177177
{
178-
Argument = "prune",
178+
Argument = "worktree prune --expire=now",
179179
WorkingDirectory = repositoryPath
180180
}, (line) =>
181181
{

GitWorkTree/Options/General.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ public partial class OptionsProvider
99
public class GeneralOptions : BaseOptionPage<General>
1010
{
1111
public bool IsLoadSolution { get; set; }
12-
public string DefaultBranchPath { get; set; }
12+
public string DefaultWorktreeDirectory { get; set; }
1313
}
1414
}
1515

1616
public class General : BaseOptionModel<General>
1717
{
18-
[DisplayName("Load Solution: ")]
19-
[Description("Load Worktree solution in Visual Studio immediately after worktree creation")]
20-
[DefaultValue("True")]
18+
[DisplayName("Load Solution")]
19+
[Description("Automatically load the worktree solution in Visual Studio after creation.")]
20+
[DefaultValue(true)]
2121
public bool IsLoadSolution { get; set; }
2222

23-
[DisplayName("Default Branch Path: ")]
24-
[Description("Default Branch Path to load newly created Worktrees")]
23+
24+
[DisplayName("Default Worktree Directory: ")]
25+
[Description("Path where new worktrees will be created. If empty, the current repository directory will be used.")]
2526
[DefaultValue("")]
26-
public string DefaultBranchPath { get; set; }
27+
public string DefaultWorktreeDirectory { get; set; }
2728
}
2829
}

GitWorkTree/ViewModel/WorkTreeDialogViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private async Task<bool> UpdateFolderPath()
221221
{
222222
if (!(commandType == CommandType.Create) || _selectedBranch_Worktree == null) return false;
223223
string worktreePath = Path.Combine(Directory.GetParent(_activeRepositoryPath).FullName, $"{_activeRepositoryPath}_Worktrees");
224-
string pathPrefix = String.IsNullOrEmpty(optionsSaved.DefaultBranchPath) ? $"{worktreePath}" : optionsSaved.DefaultBranchPath;
224+
string pathPrefix = String.IsNullOrEmpty(optionsSaved.DefaultWorktreeDirectory) ? $"{worktreePath}" : optionsSaved.DefaultWorktreeDirectory;
225225
string cleanedBranchName = _selectedBranch_Worktree.ToFolderFormat();
226226

227227
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

0 commit comments

Comments
 (0)