From 4e0dff6956c7c78858c3929650554cb302c29634 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 11 May 2018 08:21:27 +0100 Subject: [PATCH] repo git: Create size store files when they don't exist yet --- Sparkles/Git/GitRepository.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Sparkles/Git/GitRepository.cs b/Sparkles/Git/GitRepository.cs index ceb9515a..c2413053 100644 --- a/Sparkles/Git/GitRepository.cs +++ b/Sparkles/Git/GitRepository.cs @@ -98,8 +98,12 @@ namespace Sparkles.Git { get { string file_path = Path.Combine (LocalPath, ".git", "info", "size"); + if (!File.Exists (file_path)) + File.WriteAllText (file_path, "0"); + + string size = File.ReadAllText (file_path); + try { - string size = File.ReadAllText (file_path); return double.Parse (size); } catch (Exception e) { @@ -114,8 +118,12 @@ namespace Sparkles.Git { get { string file_path = Path.Combine (LocalPath, ".git", "info", "history_size"); + if (!File.Exists (file_path)) + File.WriteAllText (file_path, "0"); + + string size = File.ReadAllText (file_path); + try { - string size = File.ReadAllText (file_path); return double.Parse (size); } catch (Exception e) {