Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
5923540d
Commit
5923540d
authored
Oct 25, 2017
by
Whyrusleeping
Committed by
GitHub
Oct 25, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4305 from leerspace/fix/repo-stat-sym-link
handle sym links in when calculating repo size
parents
8923fdd9
40a9036a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
repo/fsrepo/fsrepo.go
repo/fsrepo/fsrepo.go
+6
-0
test/sharness/t0088-repo-stat-symlink.sh
test/sharness/t0088-repo-stat-symlink.sh
+27
-0
No files found.
repo/fsrepo/fsrepo.go
View file @
5923540d
...
...
@@ -637,6 +637,12 @@ func (r *FSRepo) GetStorageUsage() (uint64, error) {
return
0
,
err
}
pth
,
err
=
filepath
.
EvalSymlinks
(
pth
)
if
err
!=
nil
{
log
.
Debugf
(
"filepath.EvalSymlinks error: %s"
,
err
)
return
0
,
err
}
var
du
uint64
err
=
filepath
.
Walk
(
pth
,
func
(
p
string
,
f
os
.
FileInfo
,
err
error
)
error
{
if
err
!=
nil
{
...
...
test/sharness/t0088-repo-stat-symlink.sh
0 → 100755
View file @
5923540d
#!/bin/sh
#
# Copyright (c) 2017 John Reed
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test 'ipfs repo stat' where IPFS_PATH is a symbolic link"
.
lib/test-lib.sh
test_expect_success
"create symbolic link for IPFS_PATH"
'
mkdir sym_link_target &&
ln -s sym_link_target .ipfs
'
test_init_ipfs
# compare RepoSize when getting it directly vs via symbolic link
test_expect_success
"'ipfs repo stat' RepoSize is correct with sym link"
'
export IPFS_PATH="sym_link_target" &&
reposize_direct=$(ipfs repo stat | grep RepoSize | awk '
\'
'{ print $2 }'
\'
') &&
export IPFS_PATH=".ipfs" &&
reposize_symlink=$(ipfs repo stat | grep RepoSize | awk '
\'
'{ print $2 }'
\'
') &&
test $reposize_symlink -ge $reposize_direct
'
test_done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment