2

I ran git fsck and obtained the following:

Checking object directories: 100% (256/256), done.
Checking objects: 100% (2338/2338), done.
dangling blob b16084cfd9ca4429688cf5cf7a1948d4307f31f7

From previous questions on dangling blobs (See here, for instance) it is clear that this is not something to worry about and that it is a normal part of garbage collection process. However, I would like to find out what exactly this blob corresponds to.

Can one get, for instance, some data of which date this blob was made? What is the directory structure/file name that this blob corresponds to?

One of the answers here suggested to try git show b16084cfd9ca4429688cf5cf7a1948d4307f31f7 but this does not produce any text/human readable output. Perhaps this blob was referring to some nontext file/folder.

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
Tryer
  • 3,580
  • 1
  • 26
  • 49

3 Answers3

2

Please try with git cat-file -p b16084cfd9ca4429688cf5cf7a1948d4307f31f7.

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74
  • Unfortunately, the output of this is also not in human readable form. – Tryer Aug 21 '22 at 13:38
  • Please, post the output you got. Thank you. – Antonio Petricca Aug 21 '22 at 13:40
  • It is a huge bunch of garbage characters, the last line of which is: `e95ÿ 82é?øýfZÚë▼ð98߁}¦y9fb¶Üß`}¤o9f ☼;83לó91ÀÇ=MdÙÿ Èñ¨ÿ ׍¯þ8c¹ ♥ìzçý♦t¯ü↨Iÿ Çèû▲¹ÿ A↔+ÿ ♣Ò⌂ñú֢80?ÿ` for instance. – Tryer Aug 21 '22 at 13:41
2

It is a blob (a file content), but its "dangling" status means it is not referenced by anything else, and that you won't find its name in git.

From your comment to @AntonioPetricca's answer : it is not a text file.

One way to get more indication is to store it on disk and use a utility such as file :

git show b16084cf... > myblob
file myblob

If you know what kind of files you have in your directory (images ? zip or gzip files ? office document ? other binary files ?) you may guess what kind of file it is, and try to open it with an appropriate program (an image editor, an archive reader, office ...)


A dangling blob shouldn't be packed with other objects, so you can get an indication of when it was created (e.g : git added) by looking at the creation date of :

ls -l .git/objects/b1/6084cf...
LeGEC
  • 46,477
  • 5
  • 57
  • 104
  • This really helped! The output now is `myblob: JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, baseline, precision 8, 736x284, components 3` Is this the absolute limit upto which we can get information about this ? – Tryer Aug 21 '22 at 15:04
  • yes, after the information obtained using your answer, I gather that this was a JPEG file. I opened `myblob` using a jpeg viewer and voila, I am actually able to see the contents. Domo ari gato. – Tryer Aug 21 '22 at 15:07
  • 1
    Good ! You can get a guess of when it was added in git too (I updated my answer) – LeGEC Aug 21 '22 at 15:09
1

Update

This method cannot answer the question. But it can help, if you want to find out tracked big files, including those that exist in the history but not in the latest revision.


A blob is an object of the content of a file. From the blob hash, we cannot tell which file has the content.

First we list all commit objects,

git cat-file --batch-all-objects --batch-check | grep commit

We would get something like

1ff20d2c13f216e96cf623238242661105a97b67 commit 230
26179ca322862f4f5f74e229d6d22dff739e588b commit 183

Each line has the hash of a commit object, the object type commit and its size in byte. To search a commit object for the blob b16084cfd9ca4429688cf5cf7a1948d4307f31f7, we can use

git ls-tree -r 1ff20d2c13f216e96cf623238242661105a97b67 | grep b16084cfd9ca4429688cf5cf7a1948d4307f31f7

If the blob is found, it would print something like

100644 blob b16084cfd9ca4429688cf5cf7a1948d4307f31f7    path/to/foo.bar

So we can know the commit(s) that have the blob and its corresponding path or paths in the repository. To combine the commands,

git cat-file --batch-all-objects --batch-check | grep commit | while read osha1 otype osize;do
    result=$(git ls-tree -r $osha1 | grep -e b16084cfd9ca4429688cf5cf7a1948d4307f31f7)
    if [[ "$result" != "" ]];then
        echo commit: $osha1, $result
    fi
done
ElpieKay
  • 27,194
  • 6
  • 32
  • 53
  • I was able to replicate the steps you have indicated. On putting the last set of commands into a `.sh` file and running it, there is no error and yet nothing displayed on the screen either. I would imagine that the particular blob was overwritten or rewritten, etc. – Tryer Aug 21 '22 at 14:49
  • 1
    @ElpieKay : if it is a dangling blob, it won't be referenced by a tree or a commit ... – LeGEC Aug 21 '22 at 14:55
  • 1
    @LeGEC Ah, you're right. I made a mistake here. – ElpieKay Aug 21 '22 at 15:34
  • 1
    @Tryer As LeGEC said, my answer is wrong. The method can't work on dangling blobs. It's dangling because no other objects use it. – ElpieKay Aug 21 '22 at 15:35
  • 2
    @ElpieKay Thank you for your time regardless. I have learned more from all answers here. – Tryer Aug 21 '22 at 16:01