git 捆绑验证崩溃

git bundle verify crash

我尝试手动恢复 gitlab 备份(而不是恢复到 gitlab 实例)。我的问题如下。
我提取项目的.bundle 文件并尝试

git bundle verfiy myproject.bundle

但它总是崩溃。我在 mac os x (git 2.16) 和 windows (git 2.16.1) 上试过,但都崩溃了。发生这种情况将所有 repos 来自备份。

来自 mac os x git 的确切消息是

BUG: environment.c:181: git environment hasn't been setup Abort trap: 6

备份是使用 git 2.14

创建的

有人知道我现在能做什么吗?

问候

从消息中我可以假设它试图获取当前存储库并且有 none.

如果您的包是完整的,而不是增量的,您可以尝试初始化一个空的存储库并从中运行您的命令。

如果它是增量的,那么可能验证应该 运行 在具有较早历史的存储库中

If make a empty git repo with git init and start the verify, now it works.
That's strange, because it would be easy to display a good error message instead of a crash.

非常正确,Git 2.22.1(2019 年第 2 季度)正在做的事情:

参见 commit 3bbbe46 (27 May 2019) by Johannes Schindelin (dscho)
(由 Junio C Hamano -- gitster -- in commit abbd504 合并,2019 年 7 月 25 日)

bundle verify: error out if called without an object database

The deal with bundles is: they really are thin packs, with very little sugar on top. So we really need a repository (or more appropriately, an object database) to work with, when asked to verify a bundle.

Let's error out with a useful error message if git bundle verify is called without such an object database to work with.

Reported by Konstantin Ryabitsev.

这意味着 git/git bundle.c#verify_bundle() 功能现在包括:

if (!r || !r->objects || !r->objects->odb)
    return error(_("need a repository to verify a bundle"));

随着 Git 2.34(2021 年第 4 季度),“精简包”部分得到澄清:

参见 commit 1d9c8da, commit 0bb92f3, commit 9ab80dd, commit 5c8273d (31 Jul 2021) by Ævar Arnfjörð Bjarmason (avar)
(由 Junio C Hamano -- gitster -- in commit f19b275 合并,2021 年 8 月 24 日)

bundle doc: rewrite the "DESCRIPTION" section

Signed-off-by: Ævar Arnfjörð Bjarmason

Rewrite the "DESCRIPTION" section for "git bundle"(man) to start by talking about what bundles are in general terms, rather than diving directly into one example of what they might be used for.

This changes documentation that's been substantially the same ever since the command was added in 2e0afaf ("Add git-bundle: move objects and references by archive", 2007-02-22, Git v1.5.1-rc1 -- merge).

There was a discussion about whether to say anything at all about "thin packs" here.
I think it's good to mention it for the curious reader willing to read the technical docs, but let's explicitly say that there's no "thick pack", and that the difference shouldn't matter.

git bundle 现在包含在其 man page 中:

Create, unpack, and manipulate "bundle" files. Bundles are used for the "offline" transfer of Git objects without an active "server" sitting on the other side of the network connection.

They can be used to create both incremental and full backups of a repository, and to relay the state of the references in one repository to another.

Git commands that fetch or otherwise "read" via protocols such as ssh:// and https:// can also operate on bundle files. It is possible git clone a new repository from a bundle, to use git fetch to fetch from one, and to list the references contained within it with git ls-remote. There's no corresponding "write" support, i.e.a 'git push' into a bundle is not supported.

See the "EXAMPLES" section below for examples of how to use bundles.

BUNDLE FORMAT

Bundles are .pack files (see git pack-objects) with a header indicating what references are contained within the bundle.

Like the the packed archive format itself bundles can either be self-contained, or be created using exclusions.

Bundles created using revision exclusions are "thin packs" created using the --thin option to git pack-objects, and unbundled using the --fix-thin option to git index-pack.

There is no option to create a "thick pack" when using revision exclusions, users should not be concerned about the difference. By using "thin packs" bundles created using exclusions are smaller in size. That they're "thin" under the hood is merely noted here as a curiosity, and as a reference to other documentation

See technical/bundle-format, the bundle-format documentation for more details and the discussion of "thin pack" in technical/pack-format, the pack format documentation for further details.