Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Git/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void Init(string repository)
if (!Directory.Exists(GitPath)) Directory.CreateDirectory(GitPath);
if (!File.Exists(Path.Join(GitPath, ".git", "config"))) RunCommand($"init");

RunCommand($"config remove-section remote.origin");
RunCommandIgnoreErrors($"config remove-section remote.origin");
RunCommand($"remote add origin --mirror=fetch {repository}");
}

Expand Down Expand Up @@ -137,6 +137,18 @@ public void SetBranchRef(string branch, string reference)
RunCommand($"branch -f {branch} {reference}");
}

void RunCommandIgnoreErrors(string arguments)
{
try
{
RunCommand(arguments);
}
catch (ApplicationException)
{
// We are deliberately ignoring errors; RunCommand will have already printed them
}
}

void RunCommand(string arguments)
{
foreach (var line in GetCommandOutput(arguments, true))
Expand Down
Loading