简体   繁体   English

如何下载特定文件夹的 Chromium 代码?

[英]How to download a specific folder of Chromium code?

Recently, I tried to download source code for chromium browser.最近在尝试下载chrome浏览器的源码。 In details, I just wanted to download code at https://github.com/chromium/chromium/tree/master/chrome .具体来说,我只想在https://github.com/chromium/chromium/tree/master/chrome下载代码。 I tried several methods such as Downgit and SVN but nothing worked.我尝试了几种方法,例如 Downgit 和 SVN,但没有任何效果。 The thing is, the methods I used worked on other sites and folders.问题是,我使用的方法适用于其他站点和文件夹。 I can't understand.我无法理解。 Could anyone help me?有人可以帮助我吗? If not, please let me know any other place where I can download desktop version chromium browser source code.如果没有,请告诉我可以下载桌面版 Chrome 浏览器源代码的任何其他地方。 Thanks in advance.提前致谢。

I found this question when I was looking for the same thing and as it turns out @VonC's solution is almost right.我在寻找同样的东西时发现了这个问题,结果证明@VonC 的解决方案几乎是正确的。 You do你做

git clone \
--depth 1 \
--filter=blob:none \
--no-checkout \
https://github.com/chromium/chromium \
;
cd chromium

but before you checkout you just set core.fscache = false via the但在结帐之前,您只需通过以下方式设置core.fscache = false

git config core.fscache false

command and then continue with命令然后继续

 git sparse-checkout init --cone
 git sparse-checkout set chrome

The sha1 error is not your fault and is just a bug with git, in another similar post an issue was opened about it and this fscache was the solution they gave for the time being. sha1 错误不是你的错,只是 git 的一个错误,在另一个类似的帖子中,一个问题被打开了,这个 fscache 是他们暂时给出的解决方案。 If you're on Linux you don't even have to do this.如果你在 Linux 上,你甚至不必这样做。 The commands mentioned above would work!上面提到的命令会起作用! Cheers.干杯。

I don't want to download full source nor build it.我不想下载完整的源代码也不想构建它。 I just want to check out some codes in chromium browser source code我只是想查看一下chrome浏览器源代码中的一些代码

Since it is a Git repository, you can use a filter clone (I detail its syntax here ):由于它是一个 Git 存储库,您可以使用过滤器克隆(我在此处详细介绍其语法):

git clone \
  --depth 1 \
  --filter=blob:none \
  --no-checkout \
  https://github.com/chromium/chromium \
;
cd chromium
git checkout master -- chrome

You also have the sparse cone option :您还有稀疏锥选项

git clone \
  --depth 1 \
  --filter=blob:none \
  --no-checkout \
  https://github.com/chromium/chromium \
;
cd chromium
git sparse-checkout init --cone
git sparse-checkout set chrome

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM