Revert "Resolve symlink if it is directly referenced in cli (#2897)"
This reverts commit fe7b01f14e2b8db6e856b567dbd7db4d00f6e366. Conflicts: commands/cli/parse.go Revert "Merge pull request #3023 from ipfs/feature/eval-symlink-windows" This reverts commit 16c5a89dd44ea787f645e1fdfaf2e5b8ebb2945e, reversing changes made to 8c77ff81886da887bc33f1c775a4f8881d1281b5. Conflicts: commands/cli/parse.go License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
Kevin Atkinson committed
Aug 27, 2016 at 02:29 UTC
88e4b110badef2445f7336556a5cf6fe34f9a578
2 files changed
+7
-24
commands/cli/parse.go
+1
-7
@@ -404,13 +404,7 @@ func appendFile(fpath string, argDef *cmds.Argument, recursive, hidden bool) (fi
404
fpath = cwd
405
}
406
407
- fpath = filepath.Clean(fpath)
408
- fpath, err := filepath.EvalSymlinks(fpath)
409
- if err != nil {
410
- return nil, err
411
- }
412
- // Repeat ToSlash after EvalSymlinks as it turns path to platform specific
413
- fpath = filepath.ToSlash(fpath)
407
+ fpath = filepath.ToSlash(filepath.Clean(fpath))
408
409
stat, err := os.Lstat(fpath)
410
if err != nil {
test/sharness/t0044-add-symlink.sh
+6
-17
@@ -11,13 +11,9 @@ test_description="Test add -w"
11
test_expect_success "creating files succeeds" '
12
mkdir -p files/foo &&
13
mkdir -p files/bar &&
14
- mkdir -p files/badin
14
echo "some text" > files/foo/baz &&
16
- ln -s ../foo/baz files/bar/baz &&
17
- ln -s files/does/not/exist files/badin/bad &&
18
- mkdir -p files2/a/b/c &&
19
- echo "some other text" > files2/a/b/c/foo &&
20
- ln -s b files2/a/d
15
+ ln -s files/foo/baz files/bar/baz &&
16
+ ln -s files/does/not/exist files/bad
17
'
18
19
test_add_symlinks() {
@@ -27,34 +23,27 @@ test_add_symlinks() {
23
'
24
25
test_expect_success "output looks good" '
30
- echo QmQRgZT6xVFKJLVVpJDu3WcPkw2iqQ1jqK1F9jmdeq9zAv > filehash_exp &&
26
+ echo QmWdiHKoeSW8G1u7ATCgpx4yMoUhYaJBQGkyPLkS9goYZ8 > filehash_exp &&
27
test_cmp filehash_exp filehash_out
28
'
29
34
- test_expect_success "adding a symlink adds the file itself" '
30
+ test_expect_success "adding a symlink adds the link itself" '
31
ipfs add -q files/bar/baz > goodlink_out
32
'
33
34
test_expect_success "output looks good" '
39
- echo QmcPNXE5zjkWkM24xQ7Bi3VAm8fRxiaNp88jFsij7kSQF1 > goodlink_exp &&
35
+ echo "QmdocmZeF7qwPT9Z8SiVhMSyKA2KKoA2J7jToW6z6WBmxR" > goodlink_exp &&
36
test_cmp goodlink_exp goodlink_out
37
'
38
39
test_expect_success "adding a broken symlink works" '
44
- ipfs add -qr files/badin | head -1 > badlink_out
40
+ ipfs add -q files/bad > badlink_out
41
'
42
43
test_expect_success "output looks good" '
44
echo "QmWYN8SEXCgNT2PSjB6BnxAx6NJQtazWoBkTRH9GRfPFFQ" > badlink_exp &&
45
test_cmp badlink_exp badlink_out
46
'
51
-
52
- test_expect_success "adding with symlink in middle of path is same as\
53
-adding with no symlink" '
54
- ipfs add -rq files2/a/b/c > no_sym &&
55
- ipfs add -rq files2/a/d/c > sym &&
56
- test_cmp no_sym sym
57
- '
47
}
48
49
test_init_ipfs