[PATCH v2 compass-ci 1/3] git_mirror: fix that README.md in upstream-repos cause a load error

[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) -- 2.23.0

On Thu, Nov 19, 2020 at 08:50:39PM +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)
Please keep consistent whether the first letter to be capitalized. Thanks, Zhangyu
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) -- 2.23.0

On Fri, Nov 20, 2020 at 08:51:25AM +0800, Zhang Yu wrote:
On Thu, Nov 19, 2020 at 08:50:39PM +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)
Please keep consistent whether the first letter to be capitalized.
It's a part of error message, not a sentence, no need to be capitalized. Thanks, Yuanchao
participants (2)
-
Li Yuanchao
-
Zhang Yu