Fixed: if repository invalid then show error
This commit is contained in:
parent
ddd5cc6aa6
commit
645ec60c56
|
@ -144,20 +144,15 @@ namespace SparkleShare {
|
|||
|
||||
// Clone into the system's temporary folder
|
||||
Process.StartInfo.FileName = "git";
|
||||
Process.StartInfo.WorkingDirectory = SparklePaths.SparkleTmpPath;
|
||||
Process.StartInfo.WorkingDirectory = SparklePaths.SparklePath;
|
||||
Process.StartInfo.Arguments = String.Format ("clone {0} {1}",
|
||||
RepoRemoteUrl,
|
||||
RepoName);
|
||||
|
||||
Process.WaitForExit ();
|
||||
Process.Start ();
|
||||
string Output = Process.StandardOutput.ReadToEnd ();
|
||||
Process.WaitForExit ();
|
||||
|
||||
|
||||
// Move the folder to the SparkleShare folder when done cloning
|
||||
Process.Exited += delegate {
|
||||
|
||||
if (Output.Contains ("fatal:")) {
|
||||
if (Process.ExitCode != 0) {
|
||||
|
||||
SparkleBubble ErrorBubble =
|
||||
new SparkleBubble (String.Format(_("Something went wrong while syncing ‘{0}’"), RepoName),
|
||||
|
@ -171,31 +166,12 @@ namespace SparkleShare {
|
|||
SparkleDialog.ShowAll ();
|
||||
}
|
||||
);
|
||||
|
||||
ErrorBubble.Show ();
|
||||
|
||||
Destroy ();
|
||||
|
||||
} 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",
|
||||
"[" + RepoName + "] Repository cloned");
|
||||
|
||||
// Show a confirmation notification
|
||||
SparkleBubble FinishedBubble =
|
||||
new SparkleBubble (String.Format(_("Successfully synced folder ‘{0}’"), RepoName),
|
||||
|
@ -209,21 +185,9 @@ namespace SparkleShare {
|
|||
SparklePaths.SparklePath, RepoName);
|
||||
Process.Start ();
|
||||
} );
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue