[why] As README.md or other docs in upstream-repos, and they are not yaml file. But git-mirror load all files in upstream-repos as yaml file, so there comes out a load error.
Now files whose dirname is 'xxx/upstream-repos' will not be loaded.
[errmsg] ...in `load_repo_file': undefined method `[]=' for x:Integer (NoMethodError)
Signed-off-by: Li Yuanchao lyc163mail@163.com --- lib/git_mirror.rb | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 9648063..72ca328 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -135,6 +135,8 @@ class MirrorMain traverse_repodir("#{repodir}/#{entry}") end else + return if File.dirname(repodir) == REPO_DIR + project = File.dirname(repodir).delete_prefix("#{REPO_DIR}/") fork_name = File.basename(repodir) load_repo_file(repodir, project, fork_name)
On Sat, Nov 21, 2020 at 06:41:34PM +0800, Li Yuanchao wrote:
[why] As README.md or other docs in upstream-repos, and they are not yaml file. But git-mirror load all files in upstream-repos as yaml file, so there comes out a load error.
Now files whose dirname is 'xxx/upstream-repos' will not be loaded.
[errmsg] ...in `load_repo_file': undefined method `[]=' for x:Integer (NoMethodError)
Signed-off-by: Li Yuanchao lyc163mail@163.com
lib/git_mirror.rb | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 9648063..72ca328 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -135,6 +135,8 @@ class MirrorMain traverse_repodir("#{repodir}/#{entry}") end else
return if File.dirname(repodir) == REPO_DIR
repodir is so much like REPO_DIR, then you use File.dirname, makes it a little suspenseful, how about rename the variable name as REPOS_DIR REPO_DIRS or add comment to give some description.
Thanks, Luan Shengde
project = File.dirname(repodir).delete_prefix("#{REPO_DIR}/") fork_name = File.basename(repodir) load_repo_file(repodir, project, fork_name)
-- 2.23.0