xmake
xmake copied to clipboard
xmake 添加 github 的链接默认分支使用的是 ”master“ 而不是对应仓库的默认分支
Xmake 版本
2.7.1
操作系统版本和架构
Windows 11 家庭版 22H2
描述问题
github 默认分支名称改为了 ”main“,而 xmake 添加 github 的链接默认分支使用的是名为 ”master“ 的分支而不是默认分支,这使得新仓库不得不修改默认分支名称回到 ”master“,对于默认分支名称不是 ”master" 的仓库也会存在问题。
期待的结果
而 xmake 添加 github 的链接默认分支使用仓库的默认分支,我遇到的有 add_repositories 和 package:urls 中添加 github 链接的问题。
工程配置
No response
附加信息和错误日志
No response
可以指定分支的。。add_repositories("other-repo https://github.com/other/other-repo.git main")
https://github.com/xmake-io/xmake/blob/5d7a01ef08b5d20f43d32a91446933bf641b8cf0/xmake/modules/private/action/require/impl/actions/download.lua#L91-L92
能不能提供一个选项,clone之后不要checkout?
https://github.com/xmake-io/xmake/blob/5d7a01ef08b5d20f43d32a91446933bf641b8cf0/xmake/modules/private/action/require/impl/actions/download.lua#L91-L92
能不能提供一个选项,clone之后不要checkout?
为啥?指定了 tag/commit 都是要 checkout 的,走 branch 的原本就没 checkout, 直接 clone 了,https://github.com/xmake-io/xmake/blob/5d7a01ef08b5d20f43d32a91446933bf641b8cf0/xmake/modules/private/action/require/impl/actions/download.lua#L82
可以指定分支的。。
add_repositories("other-repo https://github.com/other/other-repo.git main")
当然知道可以指定分支,意思是这样就硬编码了使用的分支名称,这样对于未来的 Github 仓库和以前的 Github 仓库写法会不相同
改了下 再试试
我这边测试 add_repositories 可以识别默认分支,但是在 package 中的 add_urls("https://github.com/other/other-package.git") 依旧是硬编码“master”分支作为默认分支
我这边测试
add_repositories可以识别默认分支,但是在 package 中的add_urls("https://github.com/other/other-package.git")依旧是硬编码“master”分支作为默认分支
这个暂时改不了,包内部原本就是要求 add_versions 锁定 git commit/branch 的,通常不走默认分支,只有完全没配置 add_versions 才会遇到这种情况,建议加上 add_versions 配置,否则一个包每次都拉 main/master 编译安装,很容易被一些改动影响 ,不可靠。
好的