Fixed: if repository invalid then show error
This commit is contained in:
parent
18051a52e6
commit
5fa2f4ae75
|
@ -144,85 +144,49 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// Clone into the system's temporary folder
|
// Clone into the system's temporary folder
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
Process.StartInfo.WorkingDirectory = SparklePaths.SparkleTmpPath;
|
Process.StartInfo.WorkingDirectory = SparklePaths.SparklePath;
|
||||||
Process.StartInfo.Arguments = String.Format ("clone {0} {1}",
|
Process.StartInfo.Arguments = String.Format ("clone {0} {1}",
|
||||||
RepoRemoteUrl,
|
RepoRemoteUrl,
|
||||||
RepoName);
|
RepoName);
|
||||||
|
|
||||||
Process.WaitForExit ();
|
|
||||||
Process.Start ();
|
Process.Start ();
|
||||||
string Output = Process.StandardOutput.ReadToEnd ();
|
Process.WaitForExit ();
|
||||||
|
|
||||||
|
if (Process.ExitCode != 0) {
|
||||||
|
|
||||||
// Move the folder to the SparkleShare folder when done cloning
|
SparkleBubble ErrorBubble =
|
||||||
Process.Exited += delegate {
|
new SparkleBubble (String.Format(_("Something went wrong while syncing ‘{0}’"), RepoName),
|
||||||
|
"Please double check the address and\n" +
|
||||||
|
"network connection.");
|
||||||
|
|
||||||
if (Output.Contains ("fatal:")) {
|
ErrorBubble.AddAction ("", _("Try Again…"),
|
||||||
|
delegate {
|
||||||
|
SparkleDialog SparkleDialog =
|
||||||
|
new SparkleDialog (RepoRemoteUrl);
|
||||||
|
SparkleDialog.ShowAll ();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
ErrorBubble.Show ();
|
||||||
|
|
||||||
SparkleBubble ErrorBubble =
|
} else {
|
||||||
new SparkleBubble (String.Format(_("Something went wrong while syncing ‘{0}’"), RepoName),
|
|
||||||
"Please double check the address and\n" +
|
|
||||||
"network connection.");
|
|
||||||
|
|
||||||
ErrorBubble.AddAction ("", _("Try Again…"),
|
SparkleHelpers.DebugInfo ("Git",
|
||||||
delegate {
|
"[" + RepoName + "] Repository cloned");
|
||||||
SparkleDialog SparkleDialog =
|
// Show a confirmation notification
|
||||||
new SparkleDialog (RepoRemoteUrl);
|
SparkleBubble FinishedBubble =
|
||||||
SparkleDialog.ShowAll ();
|
new SparkleBubble (String.Format(_("Successfully synced folder ‘{0}’"), RepoName),
|
||||||
}
|
_("Now make great stuff happen!"));
|
||||||
);
|
|
||||||
|
|
||||||
ErrorBubble.Show ();
|
FinishedBubble.AddAction ("", _("Open Folder"),
|
||||||
|
delegate {
|
||||||
Destroy ();
|
Process.StartInfo.FileName = "xdg-open";
|
||||||
|
Process.StartInfo.Arguments =
|
||||||
} else {
|
SparkleHelpers.CombineMore (
|
||||||
|
SparklePaths.SparklePath, RepoName);
|
||||||
string OldPath =
|
Process.Start ();
|
||||||
SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath,
|
} );
|
||||||
RepoName);
|
FinishedBubble.Show ();
|
||||||
|
}
|
||||||
string NewPath =
|
|
||||||
SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
|
||||||
RepoName);
|
|
||||||
|
|
||||||
if (Directory.Exists (NewPath))
|
|
||||||
NewPath += " (2)";
|
|
||||||
|
|
||||||
// Move the cloned repository from the temporary
|
|
||||||
// folder to the SparkleShare folder
|
|
||||||
Directory.Move (OldPath, NewPath);
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git",
|
|
||||||
"[" + RepoName + "] Repository cloned");
|
|
||||||
|
|
||||||
// Show a confirmation notification
|
|
||||||
SparkleBubble FinishedBubble =
|
|
||||||
new SparkleBubble (String.Format(_("Successfully synced folder ‘{0}’"), RepoName),
|
|
||||||
_("Now make great stuff happen!"));
|
|
||||||
|
|
||||||
FinishedBubble.AddAction ("", _("Open Folder"),
|
|
||||||
delegate {
|
|
||||||
Process.StartInfo.FileName = "xdg-open";
|
|
||||||
Process.StartInfo.Arguments =
|
|
||||||
SparkleHelpers.CombineMore (
|
|
||||||
SparklePaths.SparklePath, RepoName);
|
|
||||||
Process.Start ();
|
|
||||||
} );
|
|
||||||
|
|
||||||
FinishedBubble.Show ();
|
|
||||||
|
|
||||||
// Destroy the Add dialog
|
|
||||||
Destroy ();
|
|
||||||
|
|
||||||
// Refresh the UI
|
|
||||||
SparkleShare.SparkleUI = new SparkleUI (true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// SparkleUI.NotificationIcon.SetIdleState ();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue