如何收紧物品? [英] How do I tighten my objects?

查看:156
本文介绍了如何收紧物品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用Sourcetree时,我得到:

When I try to pull on Sourcetree I get:

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
error: inflate: data stream error (unknown compression method)
fatal: loose object 982fcbfe3c97cec4319853db4e32bd77f72ae0bf (stored in .git/objects/98/2fcbfe3c97cec4319853db4e32bd77f72ae0bf) is corrupt


fatal: index-pack failed

我以前用不同的字母/数字随机字符串得到了此消息,然后决定删除该特定文件,然后得到了这个文件.因此,我假设如果我删除,拉出,删除,拉出等,我最终将清除所有错误并能够拉出.

I got this message previously with a different random string of letters/numbers, and decided to delete that specific file and then I got this one. So I'm assuming that if I delete, pull, delete, pull etc. I will eventually clear all errors and be able to pull.

有没有办法立即解决所有这些错误? IE.拧紧这些物体,以免产生松动的物体错误".

Is there a way to fix all these errors at once? ie. tighten these objects so they don't produce a "loose object error".

我为什么要得到这个?松散的物体实际上意味着什么?造成这种情况的可能原因是什么(即,我做错了什么?)以及将来如何避免这种情况?

Why am I getting this? What does it actually mean to be a loose object? What is the likely cause of this (ie. what did I do wrong to get this) and how can I avoid this in the future?

似乎我的假设是错误的,在删除了其中几个文件并尝试再次拉出之后,我得到了Fatal: pack has 88 unresolved deltas. fatal: index-pack failed.注意:如果需要,我实际上并没有删除我刚刚移走的文件.

it seems like my assumption was wrong, after deleting several of these files and trying to pull again, I get Fatal: pack has 88 unresolved deltas. fatal: index-pack failed. Note: I didn't actually delete the files I just moved them away, if they're still needed.

推荐答案

问题不在于对象是否松散(它们是松散的",而是相反的是打包的"而不是拧紧的") "),而是它们已损坏(或者,一旦将它们删除,就会完全丢失).

The problem is not that the objects are loose (they are "loose" but their opposite is "packed", not "tightened") but rather that they are damaged (or, once you remove them, missing entirely).

982fcbfe3c97cec4319853db4e32bd77f72ae0bf这样看起来很怪异的名称实际上是SHA-1 ID,它们是对象的真实名称",由git的SHA-1校验和代码(在git头上操作,然后是未压缩的代码)计算得出数据).由于SHA-1是一个加密的校验和,因此名称本身会验证数据:打开文件,解压缩文件,并对结果数据运行校验和,应产生相同的SHA-1.

The weird looking names like 982fcbfe3c97cec4319853db4e32bd77f72ae0bf are in fact SHA-1 IDs, which are the "true names" of the objects, as computed by git's SHA-1 checksum code (which operates on the git header followed by the uncompressed data). Because SHA-1 is a cryptographic checksum, the name itself validates the data: opening the file, de-compressing it, and running the checksum over the resulting data should produce the same SHA-1.

不是,这意味着名称错误或存储的数据已损坏.这就是git自动检测损坏的方式(当然,这是方法之一,但是它们都基于相同的SHA-1校验和思想).

It's not, and this means either the name is wrong, or the stored data have been damaged. This is how git automatically detects damage (well, one of the ways, but they are all based on the same SHA-1 checksum idea).

这又意味着任何存储介质(本地磁盘,SSD,云存储或您正在使用的任何存储介质)都有缺陷:它没有正确存储文件.您将需要首先处理此问题,然后继续修复您的存储库(通常通过还原备份或从仍然具有良好版本的某个位置克隆副本来进行修复).

This in turn means that whatever storage medium (local disk, SSD, cloud storage, or whatever it is you are using) is defective: it's not storing your files correctly. You will need to deal with this first, then go ahead and fix up your repository (usually by restoring a backup or cloning a copy from someplace that still has a good version).

git仓库只是带有特殊胶水的对象存储"数据库.

A git repository is just an "object store" database with some special glue.

在git中,对象是以下四种文件类型之一:提交,树,blob(文件)或标记(带注释的标记).

An object, in git, is one of four file types: commit, tree, blob (file), or tag (annotated tag).

最初,每个对象都单独存储在一个名称与对象的SHA-1校验和相匹配的文件中,git将其用作对象的名称.要从数据库中检索任何内容,您需要使用该名称.您将其提供给对象存储代码,并提取相关数据(必要时解压缩).

Initially, each object is stored separately, in a file whose name matches the object's SHA-1 checksum, which git uses as the object's name. To retrieve anything from the database, you need this name; you give this to the object store code and it extracts the associated data (decompressing if needed).

即使压缩,对象也可能占用大量磁盘空间,并且许多对象(例如源文件)与同一对象的其他版本相似.因此,为了节省更多的磁盘空间,git可以将一堆对象打包"成打包文件".在打包文件中,git相互压缩这些对象(这是您不时看到的增量压缩").生成的包文件具有其自己的SHA-1名称,而git保留其中存储的所有对象的所有SHA-1 ID的索引.如果您向存储库对象提取器询问某个对象,它将首先检查是否有松散的对象;如果找不到,它将检查包装(通过其索引),然后从那里提取.

Even compressed, however, objects can take a lot of disk space, and many objects—such as source files—are similar to other versions of the same object. So, to save more disk space, git can "pack" a bunch of objects into a "pack file". Inside a pack file, git compresses these objects against each other (this is the "delta compression" that you see now and then). The resulting pack file has its own SHA-1 name, and git keeps an index of all the SHA-1 IDs of all the objects stored within it. If you ask the repository object-extractor for an object, it first checks for a loose object; if not found, it checks the packs (via their index), and extracts it from there.

这篇关于如何收紧物品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆