设置和配置
获取和创建项目
基本快照
分支与合并
共享和更新项目
检查和比较
打补丁
调试
电子邮件
外部系统
服务器管理
指南
管理
底层命令
- 2.43.1 → 2.52.0 无更改
-
2.43.0
2023-11-20
- 2.38.1 → 2.42.4 无更改
-
2.38.0
2022-10-02
描述
Git bundle 格式是一种同时表示 refs 和 Git 对象的格式。bundle 是一个类似于 git-show-ref[1] 的格式的头部,后面跟着一个 *.pack 格式的 pack。
该格式由 git-bundle[1] 命令创建和读取,并由例如 git-fetch[1] 和 git-clone[1] 支持。
格式
我们将使用 ABNF 表示法来定义 Git bundle 格式。有关详细信息,请参阅 gitprotocol-common[5]。
v2 bundle 如下所示
bundle = signature *prerequisite *reference LF pack signature = "# v2 git bundle" LF prerequisite = "-" obj-id SP comment LF comment = *CHAR reference = obj-id SP refname LF pack = ... ; packfile
v3 bundle 如下所示
bundle = signature *capability *prerequisite *reference LF pack signature = "# v3 git bundle" LF capability = "@" key ["=" value] LF prerequisite = "-" obj-id SP comment LF comment = *CHAR reference = obj-id SP refname LF key = 1*(ALPHA / DIGIT / "-") value = *(%01-09 / %0b-FF) pack = ... ; packfile
语义
Git bundle 由几个部分组成。
-
“功能”(Capabilities),仅在 v3 格式中存在,指示 bundle 正确读取所需的功能。
-
“先决条件”(Prerequisites) 列出了 bundle 中未包含的对象,以及 bundle 的读取者在开始使用 bundle 中的数据时必须已有的对象。存储在 bundle 中的对象可以引用先决对象及其可达对象(例如,bundle 中的树对象可以引用可从先决对象达到的 blob)和/或表示为与先决对象进行增量的对象。
-
“引用”(References) 记录了历史图的末端,即 bundle 的读取者可以从中“git fetch”的内容。
-
“Pack”是“git fetch”在从拥有“References”中记录的引用的仓库获取到拥有“Prerequisites”中列出的对象引用的仓库时会发送的 pack 数据流。
在 bundle 格式中,可能有一个注释跟在先决 obj-id 后面。这是一个注释,没有特定含义。bundle 的编写者可以放置任何字符串在这里。bundle 的读取者必须忽略该注释。
功能
由于没有协商的机会,未知的 capability 会导致 git bundle 中止。
-
object-format指定了正在使用的哈希算法,并且可以接受与extensions.objectFormat配置值相同的值。 -
filter指定了一个对象过滤器,就像 git-rev-list[1] 中的--filter选项一样。生成的 pack-file 在 unbundle 后必须标记为.promisorpack-file。