Skip to content

Commit 4b22fb4

Browse files
committed
Gitsave - nuke repo if it can't be loaded or created
- this only has been observed on Windows and is related to config.lock issues.
1 parent 69f4d41 commit 4b22fb4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

app/server/sonicpi/lib/sonicpi/gitsave.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,15 @@ def initialize(path)
2020
path = path.encode('utf-8')
2121
@path = path
2222
begin
23-
@repo = Rugged::Repository.new(path + '/.git')
23+
@repo = Rugged::Repository.new(path + '.git')
2424
rescue
25-
@repo = Rugged::Repository.init_at path, false
25+
begin
26+
@repo = Rugged::Repository.init_at path, false
27+
rescue
28+
# Repo is malformed - nuke it for now!
29+
FileUtils.rm_rf path + '.git'
30+
@repo = Rugged::Repository.init_at path, false
31+
end
2632
end
2733
end
2834

0 commit comments

Comments
 (0)