Added projects. Part 5
This commit is contained in:
@@ -148,4 +148,32 @@ class GitRepo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_repo_short_info_by_id(id)
|
||||
@db.get_repo_info_by_id(id)
|
||||
end
|
||||
|
||||
def clone_repo_master(id, path)
|
||||
@error = nil
|
||||
repo_info = @db.get_repo_info_by_id(id)
|
||||
unless repo_info.nil?
|
||||
File.open("locks/gitcreate", "r") do |f|
|
||||
f.flock(File::LOCK_SH)
|
||||
git_path = File.join(@path, repo_info[:reponame] + ".git")
|
||||
if File.exist?(git_path)
|
||||
repo = Rugged::Repository.new(git_path)
|
||||
if repo.empty?
|
||||
@error = "Репозиторий пустой, нельзя добавить в проект пустой репозиторий"
|
||||
else
|
||||
#TODO clone repo
|
||||
end
|
||||
else
|
||||
@error = "Файла репозитория не существует"
|
||||
end
|
||||
end
|
||||
else
|
||||
@error = "Нет информации о репозитории"
|
||||
end
|
||||
@error
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user