Skip to content

Commit 54d7e03

Browse files
committed
gofmt fix and sharness test
gofmt fixes to fsrepo.go The sharness test checks that IPFS_PATHS that are symbolically linked to another directory are returning an appropriate size License: MIT Signed-off-by: John Reed <[email protected]>
1 parent 07029ca commit 54d7e03

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

repo/fsrepo/fsrepo.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,13 @@ func (r *FSRepo) GetStorageUsage() (uint64, error) {
636636
if err != nil {
637637
return 0, err
638638
}
639-
639+
640640
pth, err = filepath.EvalSymlinks(pth)
641641
if err != nil {
642642
log.Debugf("filepath.EvalSymlinks error: %s", err)
643643
return 0, err
644644
}
645-
645+
646646
var du uint64
647647
err = filepath.Walk(pth, func(p string, f os.FileInfo, err error) error {
648648
if err != nil {
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2017 John Reed
4+
# MIT Licensed; see the LICENSE file in this repository.
5+
#
6+
7+
test_description="Test 'ipfs repo stat' where IPFS_PATH is a symbolic link"
8+
9+
. lib/test-lib.sh
10+
11+
test_expect_success "create symbolic link for IPFS_PATH" '
12+
mkdir sym_link_target &&
13+
ln -s sym_link_target .ipfs
14+
'
15+
16+
test_init_ipfs
17+
18+
# compare RepoSize when getting it directly vs via symbolic link
19+
test_expect_success "'ipfs repo stat' RepoSize is correct with sym link" '
20+
export IPFS_PATH="sym_link_target" &&
21+
reposize_direct=$(ipfs repo stat | grep RepoSize | awk '\''{ print $2 }'\'') &&
22+
export IPFS_PATH=".ipfs" &&
23+
reposize_symlink=$(ipfs repo stat | grep RepoSize | awk '\''{ print $2 }'\'') &&
24+
test $reposize_symlink -ge $reposize_direct
25+
'
26+
27+
test_done

0 commit comments

Comments
 (0)