Sometimes there would be some not yaml like file in upstream-repos, such as README.md or user's temporary file.
Now we'll do a judge after load and before any other actions, if it's not repo file, just return.
Signed-off-by: Li Yuanchao lyc163mail@163.com --- lib/git_mirror.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 76cdd1b..22c4e07 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -223,7 +223,10 @@ end class MirrorMain def load_repo_file(repodir, project, fork_name) git_repo = "#{project}/#{fork_name}" - @git_info[git_repo] = YAML.safe_load(File.open(repodir)) + git_info = YAML.safe_load(File.open(repodir)) + return if git_info.nil? || git_info['url'].nil? + + @git_info[git_repo] = git_info @git_info[git_repo]['git_repo'] = git_repo @git_info[git_repo] = merge_defaults(git_repo, @git_info[git_repo]) fork_stat_init(git_repo)