Re: [PATCH] test: some testcases failed if cwd is on a symlink
- From
- Pete Wyckoff <pw@padd.com>
- Date
- Jul 24, 2012, 10:59 UTC
- Message-ID
- <20120724105910.GA5478@padd.com>
- In-Reply-To
- <001c60538df409d94618e80cc3faaae586ccf053.1343116581.git.worldhello.net@gmail.com>
worldhello.net@gmail.com wrote on Tue, 24 Jul 2012 16:00 +0800:
Show 7 quoted lines
> 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