git fetcher: Define branch variables up front

This commit is contained in:
Hylke Bons 2017-02-02 22:57:05 +00:00
parent a6e6b99d25
commit 8fd165bd35

View file

@ -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;