ipld / ipld/go-car

car get-dag gives `no decoder registered for multicodec code 120 (0x78)`

Open
#568 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
175
Forks
54
Avg merge
6d 5h
Merged PRs (30d)
4

Description

I can't seem to extract `git-raw` DAGs.

For example, if we add a Git repo to Kubo:

```
$ git init --quiet
$ mkdir -p foo/bar
$ echo hello > foo/bar/baz
$ git add foo/bar/baz
$ git commit -m "Hi"
[master (root-commit) 4a8cc80] Hi
1 file changed, 1 insertion(+)
create mode 100644 foo/bar/baz
$ echo goodbye > foo/bar/baz
$ git add foo/bar/baz
$ git commit -m "Bye"
[master 1c641f7] Bye
1 file changed, 1 insertion(+), 1 deletion(-)
$ ls .git/objects/*/*
.git/objects/05/4e3e01c75de2975d1bb6e436254ecf988e650f
.git/objects/1c/641f7df8a69a99c0bb1b1a1606ff1b650c6785
.git/objects/1f/72a0a3ba198abc778252eaee11142ce80244cc
.git/objects/25/42a3b2478a94f6dd2dae1a156e618a9d8bcda8
.git/objects/4a/8cc80560cf1a1a702f7bae8ec4c37aa8de9f2b
.git/objects/53/6bdc2d8a69bddedc4472fbdb3ee346d2b230a3
.git/objects/53/9ced6ac21a843e2ff88e3dc79e6ffb6dda2cc9
.git/objects/9e/0a88cb754f425b52a72ceffa96cd758c1a53ab
.git/objects/ce/013625030ba8dba906f756967f9e9ca394464a
.git/objects/dd/7e1c6f0fefe118f0b63d9f10908c460aa317a6
$ for OBJ in .git/objects/*/*; do < "$OBJ" zlib-flate -uncompress | ipfs block put --cid-codec git-raw --mhtype sha1; done
baf4bcfafjy7adr254klv2g5w4q3cktwptchgkdy
baf4bcfa4mqpx36fgtkm4boy3dilan7y3muggpbi
baf4bcfa7okqkhoqzrk6hpass5lxbcfbm5abejta
baf4bcfbfikr3er4kst3n2lnodikw4ymktwf43ka
baf4bcfckrteakygpdinhal33v2hmjq32vdpj6ky
baf4bcfctnpoc3ctjxxpnyrds7pnt5y2g2kzdbiy
baf4bcfctttwwvqq2qq7c76eohxdz4373nxnczsi
baf4bcfe6bkemw5kpijnvfjzm575jntlvrqnfhky
baf4bcfgoae3ckaylvdn2sbxxk2lh7hu4uokemsq
baf4bcfg5pyog6d7p4empbnr5t4ijbdcgbkrrpjq
```

Then make a CAR for the HEAD commit (this will include ancestors, trees and blobs thanks to the `git-raw` codec):

```
$ ipfs dag export "$(printf 'f01781114%s' "$(git rev-parse HEAD)")" > HEAD.car
0s 986 B / ? [---------------------------=-------------------------------------------------] 54.57 KiB/s 0s
$ car inspect HEAD.car
Version: 1
Roots: baf4bcfa4mqpx36fgtkm4boy3dilan7y3muggpbi
Root blocks present in data: Yes
Block count: 10
Min / average / max block length (bytes): 13 / 68 / 239
Min / average / max CID length (bytes): 24 / 24 / 24
Block count per codec:
git-raw: 10
CID count per multihash:
sha1: 10
```

`car inspect` seems happy. Now let's say we want to make a smaller CAR with just the latest tree, ignoring all the history and commit info:

```
$ car get-dag HEAD.car "$(printf 'f01781114%s' "$(git rev-parse HEAD^{tree})")" > TREE.car

2025/03/12 00:52:58 could not choose a decoder: no decoder registered for multicodec code 120 (0x78)
```

It seems like the `git-raw` multicodec isn't supported, and I couldn't find any run-time or compile-time options to adjust the supported codecs (though I might have missed it, since I'm not familiar with Go).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.