diff options
author | Eric Blake <eblake@redhat.com> | 2012-03-14 13:42:59 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2012-03-15 12:24:05 -0600 |
commit | 9f5aa4850133976eee22dcc0b506d7b632cd674c (patch) | |
tree | 868db0dba0e6b8dee1769deefe0417eae641571c /tests/misc | |
parent | 61167bae9f27269724dc577a19d2bd48a437bafb (diff) | |
download | coreutils-9f5aa4850133976eee22dcc0b506d7b632cd674c.tar.xz |
realpath: let --relative-to default to --relative-base
Most of the time, if someone wants to filter which paths are
relative while leaving all others absolute, they also want to
to the filtering based on the same --relative-to directory.
Make this easier to specify.
* src/realpath.c (main): Convert error to default.
* doc/coreutils.texi (realpath invocation): Document this.
* tests/misc/realpath: Adjust test to match.
* NEWS: Document it.
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/realpath | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/misc/realpath b/tests/misc/realpath index 1b83a0496..9484ac4c8 100755 --- a/tests/misc/realpath +++ b/tests/misc/realpath @@ -43,11 +43,8 @@ ln -s /// three || framework_failure_ realpath -Pqz . >/dev/null || fail=1 # Operand is required realpath >/dev/null && fail=1 -# --relative-base and --relative-to require params realpath --relative-base . --relative-to . && fail=1 -# --relative-base requires --relative-to -realpath --relative-base=dir1 . && fail=1 -realpath --relative-base --relative-to=dir1 . && fail=1 +realpath --relative-base . && fail=1 # -e --relative-* require directories realpath -e --relative-to=dir1/f --relative-base=. . && fail=1 @@ -78,6 +75,11 @@ out=$(realpath -sm --relative-base=/usr --relative-to=/usr /tmp /usr) || fail=1 test "$out" = "/tmp$nl." || fail=1 out=$(realpath -sm --relative-base=/ --relative-to=/ / /usr) || fail=1 test "$out" = ".${nl}usr" || fail=1 +# --relative-to defaults to the value of --relative-base +out=$(realpath -sm --relative-base=/usr /tmp /usr) || fail=1 +test "$out" = "/tmp$nl." || fail=1 +out=$(realpath -sm --relative-base=/ / /usr) || fail=1 +test "$out" = ".${nl}usr" || fail=1 # For now, --relative-base must be a prefix of --relative-to, or all output # will be absolute (compare to MacOS 'relpath -d dir start end'). out=$(realpath -sm --relative-base=/usr/local --relative-to=/usr \ |