Consider the following example:
$ mkdir -p foo/bar1 foo/bar2 $ touch foo/bar1/baz $ ln -s ../bar1/baz foo/bar2 $ ln -s bar1 foo/bar3 $ ls -l foo/bar*/baz -rw-rw-r-- 1 auno auno 0 Nov 6 12:35 foo/bar1/baz lrwxrwxrwx 1 auno auno 11 Nov 6 12:35 foo/bar2/baz -> ../bar1/baz -rw-rw-r-- 1 auno auno 0 Nov 6 12:35 foo/bar3/baz $ get_realpath foo/bar2/baz /tmp/foo/bar2/baz $ no_symlinks=true get_realpath foo/bar2/baz /tmp/foo/bar2/baz $ readlink -f foo/bar2/baz /tmp/foo/bar1/baz $ get_realpath foo/bar3/baz /tmp/foo/bar3/baz $ no_symlinks=true get_realpath foo/bar3/baz /tmp/foo/bar1/baz
get_realpath evidently only resolves symlinks in the dirname part of the given input path.