diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-03-07 22:12:46 -0800 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-03-07 22:13:10 -0800 |
commit | aafdd8eead6b5856b9adecdbcec86acc194b8af0 (patch) | |
tree | 91bf8afb2474efeed893ea35ab33847072c58f92 | |
parent | 0689a4a16f5e80e0c2368f4a68c69ce5f2fdc038 (diff) | |
download | bfs-aafdd8eead6b5856b9adecdbcec86acc194b8af0.tar.xz |
eval: Fix -unique with -depth
-rw-r--r-- | eval.c | 2 | ||||
-rwxr-xr-x | tests.sh | 10 | ||||
-rw-r--r-- | tests/test_L_unique_depth.out | 3 | ||||
-rw-r--r-- | tests/test_unique_depth.out | 19 |
4 files changed, 33 insertions, 1 deletions
@@ -1256,7 +1256,7 @@ static enum bftw_action cmdline_callback(struct BFTW *ftwbuf, void *ptr) { goto done; } - if (cmdline->unique) { + if (cmdline->unique && ftwbuf->visit == BFTW_PRE) { if (!eval_file_unique(&state, args->seen)) { goto done; } @@ -649,8 +649,10 @@ bfs_tests=( test_type_multi test_unique + test_unique_depth test_L_unique test_L_unique_loops + test_L_unique_depth test_xtype_multi test_xtype_reorder @@ -1987,6 +1989,10 @@ function test_unique() { bfs_diff links/{file,symlink,hardlink} -unique } +function test_unique_depth() { + bfs_diff basic -unique -depth +} + function test_L_unique() { bfs_diff -L links/{file,symlink,hardlink} -unique } @@ -1995,6 +2001,10 @@ function test_L_unique_loops() { bfs_diff -L loops/deeply/nested -unique } +function test_L_unique_depth() { + bfs_diff -L loops/deeply/nested -unique -depth +} + if [ -t 1 -a ! "$VERBOSE" ]; then in_place=yes fi diff --git a/tests/test_L_unique_depth.out b/tests/test_L_unique_depth.out new file mode 100644 index 0000000..dad0a98 --- /dev/null +++ b/tests/test_L_unique_depth.out @@ -0,0 +1,3 @@ +loops/deeply/nested +loops/deeply/nested/dir +loops/deeply/nested/loop diff --git a/tests/test_unique_depth.out b/tests/test_unique_depth.out new file mode 100644 index 0000000..bb3cd8d --- /dev/null +++ b/tests/test_unique_depth.out @@ -0,0 +1,19 @@ +basic +basic/a +basic/b +basic/c +basic/e +basic/g +basic/i +basic/j +basic/k +basic/l +basic/c/d +basic/e/f +basic/g/h +basic/j/foo +basic/k/foo +basic/l/foo +basic/k/foo/bar +basic/l/foo/bar +basic/l/foo/bar/baz |