Skip to content

Commit

Permalink
Update go-ipld-git plugin, add more resolution tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Aug 4, 2021
1 parent 70eed4e commit bbc722b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require (
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipld-cbor v0.0.5
github.com/ipfs/go-ipld-format v0.2.0
github.com/ipfs/go-ipld-git v0.0.4-0.20210726071918-f3dcf6c6f96e
github.com/ipfs/go-ipld-git v0.0.5-0.20210804024000-9218898fbcca
github.com/ipfs/go-ipld-legacy v0.0.0-20210325015318-9799f2cffab0
github.com/ipfs/go-ipns v0.0.2
github.com/ipfs/go-log v1.0.4
Expand All @@ -62,7 +62,7 @@ require (
github.com/ipfs/interface-go-ipfs-core v0.4.1-0.20210410030100-56c2e678cb62
github.com/ipld/go-car v0.3.1
github.com/ipld/go-codec-dagpb v1.2.1-0.20210405170603-d0b86f7623c2
github.com/ipld/go-ipld-prime v0.10.1-0.20210727022528-083c39518830
github.com/ipld/go-ipld-prime v0.10.1-0.20210729021320-145d8235e5de
github.com/jbenet/go-is-domain v1.0.5
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c
github.com/jbenet/go-temp-err-catcher v0.1.0
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,8 @@ github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dC
github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k=
github.com/ipfs/go-ipld-format v0.2.0 h1:xGlJKkArkmBvowr+GMCX0FEZtkro71K1AwiKnL37mwA=
github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs=
github.com/ipfs/go-ipld-git v0.0.4-0.20210726071918-f3dcf6c6f96e h1:nIn/bK6M+x9YjgDIs0JU9BexgFlOiSXA5MnVIOK3yhM=
github.com/ipfs/go-ipld-git v0.0.4-0.20210726071918-f3dcf6c6f96e/go.mod h1:DHEYwGO2tc27/7VVRtNqFvJBFbLufPW75eGkvYJgNcU=
github.com/ipfs/go-ipld-git v0.0.5-0.20210804024000-9218898fbcca h1:l29Ym/qY0FjxxJDtvrWTuc/xWDRypjdrpKmApT7tRgI=
github.com/ipfs/go-ipld-git v0.0.5-0.20210804024000-9218898fbcca/go.mod h1:+PkG+NLJJ4F2EBnJTwf+6G7kknVYzOJ8K3Rxln2a3aA=
github.com/ipfs/go-ipld-legacy v0.0.0-20210325015318-9799f2cffab0 h1:PXjRvJkxqQ2EbwviF5GEURYqvhS/ulee/ZdVsVgVtHM=
github.com/ipfs/go-ipld-legacy v0.0.0-20210325015318-9799f2cffab0/go.mod h1:86f5P/srAmh9GcIcWQR9lfFLZPrIyyXQeVlOWeeWEuI=
github.com/ipfs/go-ipns v0.0.2 h1:oq4ErrV4hNQ2Eim257RTYRgfOSV/s8BDaf9iIl4NwFs=
Expand Down Expand Up @@ -514,9 +514,8 @@ github.com/ipld/go-codec-dagpb v1.2.1-0.20210405170603-d0b86f7623c2/go.mod h1:GM
github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.9.1-0.20210324083106-dc342a9917db/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.9.1-0.20210402181957-7406578571d1/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.10.1-0.20210723093545-ebe39c7bab39/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.10.1-0.20210727022528-083c39518830 h1:tQyWv1pyxNIFe2hPczHGITClSQRJlW6dLIcEvkdSRgY=
github.com/ipld/go-ipld-prime v0.10.1-0.20210727022528-083c39518830/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.10.1-0.20210729021320-145d8235e5de h1:ywbFKcs58Qbb+SNoSG3b0ZfTSXLUkZmyJDy9Dg33KHU=
github.com/ipld/go-ipld-prime v0.10.1-0.20210729021320-145d8235e5de/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA=
github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
Expand Down
21 changes: 18 additions & 3 deletions test/sharness/t0280-plugin-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,28 @@ test_dag_git() {
cat hashes | xargs -I {} ipfs dag get -- {} > /dev/null
'

test_expect_success "dag get works" '
echo -n "{\"message\":\"Some version\n\",\"object\":{\"/\":\"baf4bcfeq6c2mspupcvftgevza56h7rmozose6wi\"},\"tag\":\"v1\",\"tagger\":{\"date\":\"1497302532\",\"email\":\"johndoe@example.com\",\"name\":\"John Doe\",\"timezone\":\"+0200\"},\"type\":\"commit\"}" > tag_expected &&
ipfs dag get baf4bcfhzi72pcj5cc4ocz7igcduubuu7aa3cddi > tag_actual
'

test_expect_success "outputs look correct" '
test_cmp tag_expected tag_actual
'

test_expect_success "path traversals work" '
echo -n "{\"/\":{\"bytes\":\"YmxvYiA3ACcsLnB5Zgo=\"}}" > file1 &&
ipfs dag get baf4bcfhzi72pcj5cc4ocz7igcduubuu7aa3cddi/object/parents/0/tree/dir2/hash/f3/hash > out1
echo -n "{\"date\":\"1497302532\",\"email\":\"johndoe@example.com\",\"name\":\"John Doe\",\"timezone\":\"+0200\"}" > author_expected &&
echo -n "{\"/\":{\"bytes\":\"YmxvYiAxMgBIZWxsbyB3b3JsZAo=\"}}" > file1_expected &&
echo -n "{\"/\":{\"bytes\":\"YmxvYiA3ACcsLnB5Zgo=\"}}" > file2_expected &&
ipfs dag get baf4bcfhzi72pcj5cc4ocz7igcduubuu7aa3cddi/object/author > author_actual &&
ipfs dag get baf4bcfhzi72pcj5cc4ocz7igcduubuu7aa3cddi/object/tree/file/hash > file1_actual &&
ipfs dag get baf4bcfhzi72pcj5cc4ocz7igcduubuu7aa3cddi/object/parents/0/tree/dir2/hash/f3/hash > file2_actual
'

test_expect_success "outputs look correct" '
test_cmp file1 out1
test_cmp author_expected author_actual &&
test_cmp file1_expected file1_actual &&
test_cmp file2_expected file2_actual
'
}

Expand Down

0 comments on commit bbc722b

Please sign in to comment.