在 Ceph 中使用 git 子模块

loic

gf-completejerasure 库实现了 纠删码 函数,这些函数用于 Ceph。它们于 2013 年复制到 Ceph 中,因为当时没有参考仓库。该副本已从 Ceph 仓库中 删除,并 替换为 git 子模块,以解耦发布周期。

如果需要紧急更改(例如在 Ceph 发布之前不久),等待拉取请求被审查和合并可能不方便。在 ceph 命名空间 中为 jerasuregf-complete 创建了仓库的副本。
为 jerasure v2 和 gf-complete v1 创建了一个稳定的分支。git 子模块指向这些发布分支,如下所示

git submodule add -b v1 https://github.com/ceph/gf-complete.git src/erasure-code/jerasure/gf-complete git submodule add -b v2 https://github.com/ceph/jerasure.git src/erasure-code/jerasure/jerasure

在检出带有新子模块的分支时,需要更新它们以克隆和检出所需的分支。

git submodule update

为了与 jerasure 上游协作,定义了三个远程仓库:一个用于上游(jimplank,只读),一个用于在适合提交拉取请求的位置上游的分支(loic,读写),一个用于来自 ceph 的镜像(ceph,读写)。

$ git remote add loic git@bitbucket.org:dachary/jerasure.git $ git remote -vv ceph git@github.com:ceph/jerasure.git (fetch) ceph git@github.com:ceph/jerasure.git (push) jimplank http://jerasure.org/jerasure/jerasure.git (fetch) jimplank http://jerasure.org/jerasure/jerasure.git (push) loic git@bitbucket.org:dachary/jerasure.git (fetch) loic git@bitbucket.org:dachary/jerasure.git (push)

从上游 master 分支 jimplank/master 创建一个本地分支 wip-compilation-warnings

$ git checkout -b wip-compilation-warnings jimplank/master Branch wip-compilation-warnings set up to track remote branch master from jimplank. Switched to a new branch 'wip-compilation-warnings' loic@fold:~/software/ceph/jerasure$ git branch -vv * wip-compilation-warnings 87f3010 [jimplank/master] remove unused variables

完成工作后,将其推送

git push loic wip-compilation-warnings

并向 upstream 发送拉取请求。合并到 master 后,提交会回溯到稳定分支 v2

git checkout -b wip-compilation-warnings-v2 jimplank/v2 git cherry-pick -x da3b767 git push loic wip-compilation-warnings-v2

并向 upstream 发送拉取请求。

可以通过修改从 ceph 命名空间到 pull request 等待审查的位置的上游 URL,在本地测试与 Ceph 的集成

diff --git a/.gitmodules b/.gitmodules index b51c509..e22aaac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,5 +13,5 @@ branch = v1 [submodule "src/erasure-code/jerasure/jerasure"] path = src/erasure-code/jerasure/jerasure

必须更新子模块以考虑此修改,并使用以下命令指向包含最新更改的分支

git submodule sync git submodule update --remote src/erasure-code/jerasure/jerasure

如果上游接受需要时间,可以将回溯推送到 Ceph 命名空间以立即使用

git checkout ceph/v2 git cherry-pick -x da3b767 git push ceph v2

并更新 Ceph 仓库以指向 v2 分支的最新提交,使用

git submodule update --remote src/erasure-code/jerasure/jerasure git add src/erasure-code/jerasure/jerasure git commit -m 'sync latest upstream'