Skip to content

Commit 27a56b7

Browse files
committed
add missing json fields
1 parent 5f6adf2 commit 27a56b7

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

internal/git/git_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@ package git
33
import (
44
"context"
55
"testing"
6+
"path/filepath"
67

78
"github.com/ipfs/go-merkledag/dagutils"
89
)
910

1011
func TestImportFromURL(t *testing.T) {
1112
ctx := context.Background()
12-
dag := dagutils.NewMemoryDagService()
13+
mem := dagutils.NewMemoryDagService()
1314

14-
_, err := ImportFromURL(ctx, dag, "test", "https://github.com/multiverse-vcs/go-multiverse")
15+
path, err := filepath.Abs("./../../")
16+
if err != nil {
17+
t.Fatal("failed to get absolute path")
18+
}
19+
20+
_, err = ImportFromFS(ctx, mem, "test", path)
1521
if err != nil {
1622
t.Fatal("failed to import git repo")
1723
}

pkg/rpc/file/search.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ import (
1515
// SearchArgs contains the args.
1616
type SearchArgs struct {
1717
// Remote is the remote path.
18-
Remote string
18+
Remote string `json:"remote"`
1919
// Branch is the branch name.
20-
Branch string
20+
Branch string `json:"branch"`
2121
// Path is the file path.
22-
Path string
22+
Path string `json:"path"`
2323
}
2424

2525
// SearchReply contains the reply.
2626
type SearchReply struct {
2727
// Content contains file content.
28-
Content string
28+
Content string `json:"content"`
2929
// Entries contains directory entries.
30-
Entries []*fs.DirEntry
30+
Entries []*fs.DirEntry `json:"entries"`
3131
// IsDir specifies if the file is a directory.
32-
IsDir bool
32+
IsDir bool `json:"is_dir"`
3333
}
3434

3535
// Search returns the contents of a file at the given remote path.

pkg/rpc/repo/search.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313
// SearchArgs contains the args.
1414
type SearchArgs struct {
1515
// Remote is the remote path.
16-
Remote string
16+
Remote string `json"remote"`
1717
}
1818

1919
// SearchReply contains the reply.
2020
type SearchReply struct {
21-
Repository *object.Repository
21+
Repository *object.Repository `json:"repository"`
2222
}
2323

2424
// Search returns the repository at the given remote path.

0 commit comments

Comments
 (0)