Subject: Re: [PATCH] test: some testcases failed if cwd is on a symlink

From: Pete Wyckoff <[email-masked]>
Date: Tue, 24 Jul 2012 06:59:10 -0400

[email-masked] wrote on Tue, 24 Jul 2012 16:00 +0800:
> Run command 'git rev-parse --git-dir' under subdir will return realpath
> of '.git' directory. Some test scripts compare this realpath against
> "$TRASH_DIRECTORY", they are not equal if current working directory is
> on a symlink.
> 
> In this fix, get realpath of "$TRASH_DIRECTORY", store it in
> "$TRASH_REALPATH" variable, and use it when necessary.

We have the same problem with p4.  I fixed it in t98* in
23bd0c9 (git p4 test: use real_path to resolve p4 client
symlinks, 2012-06-27), but maybe an exported
TRASH_DIRECTORY_REAL_PATH might be generally useful.

> +TRASH_REALPATH="$(cd "$TRASH_DIRECTORY"; pwd -P)"

There's a portable test helper that does this already:

    path=$(test-path-utils real_path "$path")

		-- Pete