Skip to content

Commit

Permalink
Fix refs -r -u for ipfs#1211
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Gaetan Voyer-Perrault <gatesvp@gmail.com>
  • Loading branch information
gatesvp authored and kbala444 committed Aug 15, 2015
1 parent 0d25881 commit d35694a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
4 changes: 0 additions & 4 deletions core/commands/refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,6 @@ func (rw *RefWriter) writeRefsRecursive(n *dag.Node) (int, error) {
return 0, err
}

if rw.skip(nkey) {
return 0, nil
}

var count int
for i, ng := range rw.DAG.GetDAG(rw.Ctx, n) {
lk := key.Key(n.Links[i].Hash)
Expand Down
24 changes: 24 additions & 0 deletions test/sharness/t0080-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,30 @@ test_expect_success "'ipfs pin ls --type=all --quiet' is correct" '
test_sort_cmp allpins_uniq_hashes actual_allpins
'

test_expect_success "'ipfs refs --unique' is correct" '
mkdir -p uniques &&
cd uniques &&
echo "content1" > file1 &&
echo "content1" > file2 &&
ROOT=$(ipfs add -r -q . | tail -n1) &&
ipfs refs --unique $ROOT >expected &&
ipfs add -q file1 >unique_hash &&
test_cmp expected unique_hash
'

test_expect_success "'ipfs refs --unique --recursive' is correct" '
mkdir -p a/b/c &&
echo "c1" > a/f1 &&
echo "c1" > a/b/f1 &&
echo "c1" > a/b/c/f1 &&
echo "c2" > a/b/c/f2 &&
ROOT=$(ipfs add -r -q a | tail -n1) &&
ipfs refs --unique --recursive $ROOT >refs_output &&
wc -l refs_output | sed "s/^ *//g" >line_count &&
echo "4 refs_output" >expected &&
test_cmp expected line_count
'

test_kill_ipfs_daemon

test_done

0 comments on commit d35694a

Please sign in to comment.