Added projects. Part 5

This commit is contained in:
alexey
2025-02-28 00:13:04 +03:00
parent 34a69e1a1d
commit 77f9fa7da2
7 changed files with 121 additions and 7 deletions

View File

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