From 8fd165bd35a4d33e93ab5a17f8fc964d6a12ef05 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 2 Feb 2017 22:57:05 +0000 Subject: [PATCH] git fetcher: Define branch variables up front --- Sparkles/Git/GitFetcher.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sparkles/Git/GitFetcher.cs b/Sparkles/Git/GitFetcher.cs index 87586df0..efe12ab6 100644 --- a/Sparkles/Git/GitFetcher.cs +++ b/Sparkles/Git/GitFetcher.cs @@ -311,15 +311,17 @@ namespace Sparkles.Git { if (string.IsNullOrWhiteSpace (output)) return StorageType.Unknown; + string encrypted_storage_prefix = "x-sparkleshare-encrypted-"; + string large_file_storage_prefix = "x-sparkleshare-lfs"; + foreach (string line in output.Split ("\n".ToCharArray ())) { + // Remote branches are outputed as "remote/branch", we need the second part string [] line_parts = line.Split ('/'); string branch = line_parts [line_parts.Length - 1]; - if (branch == "x-sparkleshare-lfs") + if (branch == large_file_storage_prefix) return StorageType.LargeFiles; - string encrypted_storage_prefix = "x-sparkleshare-encrypted-"; - if (branch.StartsWith (encrypted_storage_prefix)) { password_salt = branch.Replace (encrypted_storage_prefix, ""); return StorageType.Encrypted;