Permalink
Browse files

Merge pull request #1844 from hbons/fix/misc

repo git: Create size store files when they don't exist yet
  • Loading branch information...
hbons committed May 11, 2018
2 parents f9c60cb + 4e0dff6 commit 545d274a8bc409e032073fa74b270762248ff897
Showing with 10 additions and 2 deletions.
  1. +10 −2 Sparkles/Git/GitRepository.cs
@@ -98,8 +98,12 @@ public GitRepository (string path, Configuration config, SSHAuthenticationInfo a
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 @@ public GitRepository (string path, Configuration config, SSHAuthenticationInfo a
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) {

0 comments on commit 545d274

Please sign in to comment.