From a9cd7c825de3649d15710772102f09fe6f343a01 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Wed, 29 Jun 2016 17:54:53 +0100 Subject: [PATCH] fetcher: Fix storage type detection and progress --- SparkleShare/Common/StatusIconController.cs | 6 ++---- Sparkles/BaseFetcher.cs | 2 ++ Sparkles/Git/GitCommand.cs | 6 +++--- Sparkles/Git/GitFetcher.cs | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SparkleShare/Common/StatusIconController.cs b/SparkleShare/Common/StatusIconController.cs index 03c34f3c..82170a18 100644 --- a/SparkleShare/Common/StatusIconController.cs +++ b/SparkleShare/Common/StatusIconController.cs @@ -230,12 +230,10 @@ namespace SparkleShare { progress_speed = SparkleShare.Controller.ProgressSpeedDown.ToSize () + "/s "; if (progress_percentage > 0) - StateText += string.Format (" {0}% {1} – {2}", progress_percentage, progress_speed); + StateText += string.Format (" {0}% {1}", progress_percentage, progress_speed); if (!string.IsNullOrEmpty (SparkleShare.Controller.ProgressInformation)) - StateText += string.Format (" {0} – {1}", StateText, SparkleShare.Controller.ProgressInformation); - - SparkleShare.Controller.ProgressInformation) + StateText += string.Format ("{0} – {1}", StateText, SparkleShare.Controller.ProgressInformation); UpdateIconEvent (CurrentState); UpdateStatusItemEvent (StateText); diff --git a/Sparkles/BaseFetcher.cs b/Sparkles/BaseFetcher.cs index fd6e67a2..857c1684 100644 --- a/Sparkles/BaseFetcher.cs +++ b/Sparkles/BaseFetcher.cs @@ -176,6 +176,8 @@ namespace Sparkles { public virtual string Complete (StorageType storage_type) { + FetchedRepoStorageType = storage_type; + if (IsFetchedRepoEmpty) CreateInitialChangeSet (); diff --git a/Sparkles/Git/GitCommand.cs b/Sparkles/Git/GitCommand.cs index 1e0ab146..38724f7c 100644 --- a/Sparkles/Git/GitCommand.cs +++ b/Sparkles/Git/GitCommand.cs @@ -97,7 +97,7 @@ namespace Sparkles.Git { static Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled); - static Regex progress_regex_lfs = new Regex (@".*([0-9]+) of ([0-9]+).*", RegexOptions.Compiled); + static Regex progress_regex_lfs = new Regex (@".*([0-9]+) of ([0-9]+) files.*", RegexOptions.Compiled); static Regex speed_regex = new Regex (@"([0-9\.]+) ([KM])iB/s", RegexOptions.Compiled); public static ErrorStatus ParseProgress (string line, out double percentage, out double speed, out string information) @@ -122,14 +122,14 @@ namespace Sparkles.Git { match = progress_regex.Match (line); - if (!match.Success && !string.IsNullOrWhiteSpace (line)) { + if (!match.Success || string.IsNullOrWhiteSpace (line)) { Logger.LogInfo ("Git", line); return FindError (line); } int number = int.Parse (match.Groups [1].Value); - // The pushing progress consists of two stages: the "Compressing + // The transfer process consists of two stages: the "Compressing // objects" stage which we count as 20% of the total progress, and // the "Writing objects" stage which we count as the last 80% if (line.Contains ("Compressing objects")) { diff --git a/Sparkles/Git/GitFetcher.cs b/Sparkles/Git/GitFetcher.cs index 60d592cf..fa77218a 100644 --- a/Sparkles/Git/GitFetcher.cs +++ b/Sparkles/Git/GitFetcher.cs @@ -168,15 +168,15 @@ namespace Sparkles.Git { public override string Complete (StorageType selected_storage_type) { + string identifier = base.Complete (selected_storage_type); + string identifier_path = Path.Combine (TargetFolder, ".sparkleshare"); + InstallConfiguration (); InstallGitLFS (); InstallAttributeRules (); InstallExcludeRules (); - string identifier = base.Complete (selected_storage_type); - string identifier_path = Path.Combine (TargetFolder, ".sparkleshare"); - if (IsFetchedRepoEmpty) { File.WriteAllText (identifier_path, identifier);