]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
contrib: relpath.sh /lib /include [PR119081]
authorJason Merrill <jason@redhat.com>
Tue, 11 Mar 2025 21:43:35 +0000 (17:43 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 12 Mar 2025 15:23:59 +0000 (11:23 -0400)
Previously, if the common ancestor of the two paths is / we would print the
absolute second argument, but this PR asks for a relative path in that case
as well, which makes sense for the libstdc++.modules.json use case.

PR libstdc++/119081

contrib/ChangeLog:

* relpath.sh: Give relative path even at /.

contrib/relpath.sh

index ac6b769ef81a18ee250c9e1d52fccb0db15397af..1b329fc04a78e9c273d0c29bbe194c745a703c7f 100755 (executable)
@@ -59,9 +59,9 @@ while [ "${to#$from}" = "$to" ]; do
     from=$(dirname $from);
     back=../$back
 
-    if [ "$from" = "/" ]; then
-       echo $to
-       exit 0
+    if [ "$from" = / ] && [ "${to#/}" = "$to" ]; then
+       echo no common ancestor between $1 and $2 >&2
+       exit 1
     elif [ "$from" = . ]; then
        echo no common ancestor between $1 and $2 >&2
        exit 1