Fixed: if repository invalid then show error

This commit is contained in:
Oleg Khlystov 2010-06-13 17:42:54 +04:00
parent 18051a52e6
commit 5fa2f4ae75

View file

@ -144,20 +144,15 @@ 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
Process.Exited += delegate {
if (Output.Contains ("fatal:")) {
SparkleBubble ErrorBubble = SparkleBubble ErrorBubble =
new SparkleBubble (String.Format(_("Something went wrong while syncing {0}"), RepoName), new SparkleBubble (String.Format(_("Something went wrong while syncing {0}"), RepoName),
@ -171,31 +166,12 @@ namespace SparkleShare {
SparkleDialog.ShowAll (); SparkleDialog.ShowAll ();
} }
); );
ErrorBubble.Show (); ErrorBubble.Show ();
Destroy ();
} else { } else {
string OldPath =
SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath,
RepoName);
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", SparkleHelpers.DebugInfo ("Git",
"[" + RepoName + "] Repository cloned"); "[" + RepoName + "] Repository cloned");
// Show a confirmation notification // Show a confirmation notification
SparkleBubble FinishedBubble = SparkleBubble FinishedBubble =
new SparkleBubble (String.Format(_("Successfully synced folder {0}"), RepoName), new SparkleBubble (String.Format(_("Successfully synced folder {0}"), RepoName),
@ -209,21 +185,9 @@ namespace SparkleShare {
SparklePaths.SparklePath, RepoName); SparklePaths.SparklePath, RepoName);
Process.Start (); Process.Start ();
} ); } );
FinishedBubble.Show (); FinishedBubble.Show ();
// Destroy the Add dialog
Destroy ();
// Refresh the UI
SparkleShare.SparkleUI = new SparkleUI (true);
} }
// SparkleUI.NotificationIcon.SetIdleState ();
};
} }
// Enables the Add button when the fields are // Enables the Add button when the fields are