Merge pull request #1844 from hbons/fix/misc

repo git: Create size store files when they don't exist yet
This commit is contained in:
Hylke Bons 2018-05-11 08:23:34 +01:00 committed by GitHub
commit 545d274a8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {