Added projects. Part 6
This commit is contained in:
@@ -165,7 +165,11 @@ class GitRepo
|
||||
if repo.empty?
|
||||
@error = "Репозиторий пустой, нельзя добавить в проект пустой репозиторий"
|
||||
else
|
||||
#TODO clone repo
|
||||
if File.exist?(path)
|
||||
FileUtils.rm_rf(path, secure: true)
|
||||
end
|
||||
Dir.mkdir(path)
|
||||
Rugged::Repository.clone_at(repo.path, path)
|
||||
end
|
||||
else
|
||||
@error = "Файла репозитория не существует"
|
||||
@@ -176,4 +180,18 @@ class GitRepo
|
||||
end
|
||||
@error
|
||||
end
|
||||
|
||||
def is_repos_sync(repo_name, prj_repo_path)
|
||||
res = false
|
||||
repo = Rugged::Repository.new(prj_repo_path)
|
||||
File.open("locks/gitcreate", "r") do |f|
|
||||
f.flock(File::LOCK_SH)
|
||||
git_path = File.join(@path, repo_name + ".git")
|
||||
bare_repo = Rugged::Repository.new(git_path)
|
||||
pp bare_repo.head
|
||||
pp repo.head
|
||||
res = (bare_repo.head.oid == repo.head.oid)
|
||||
end
|
||||
res
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user