Jiang Xin <[email protected]> writes:
> Some testcases will fail if current work directory is on a symlink.
>
> symlink$ sh ./t4035-diff-quiet.sh
> $ sh ./t4035-diff-quiet.sh --root=/symlink
> $ TEST_OUTPUT_DIRECTORY=/symlink sh ./t4035-diff-quiet.sh
>
> This is because the realpath of ".git" directory will be returned when
> running the command 'git rev-parse --git-dir' in a subdir of the work
> tree, and the realpath may not equal to "$TRASH_DIRECTORY".
>
> In this fix, "$TRASH_DIRECTORY" is determined right after the realpath
> of CWD is resolved.
>
> Signed-off-by: Jiang Xin <[email protected]>
> Reported-by: Michael Haggerty <[email protected]>
> Signed-off-by: Jiang Xin <[email protected]>
> ---
I think this is in line with what was discussed in the other thread
Michael brought this up. Thanks for following it through.
Michael, this looks good to me; anything I missed?
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 78c42..9a59ca8 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -531,17 +531,17 @@ fi
> test="trash directory.$(basename "$0" .sh)"
> test -n "$root" && test="$root/$test"
> case "$test" in
> -/*) TRASH_DIRECTORY="$test" ;;
> - *) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$test" ;;
> +/*) ;;
> + *) test="$TEST_OUTPUT_DIRECTORY/$test" ;;
> esac
> -test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY
> +test ! -z "$debug" || remove_trash=$test
> rm -fr "$test" || {
> GIT_EXIT_OK=t
> echo >&5 "FATAL: Cannot prepare test area"
> exit 1
> }
>
> -HOME="$TRASH_DIRECTORY"
> +HOME="$test"
> export HOME
>
> if test -z "$TEST_NO_CREATE_REPO"; then
> @@ -552,6 +552,7 @@ fi
> # Use -P to resolve symlinks in our working directory so that the cwd
> # in subprocesses like git equals our $PWD (for pathname comparisons).
> cd -P "$test" || exit 1
> +TRASH_DIRECTORY="$(pwd)"
>
> this_test=${0##*/}
> this_test=${this_test%%-*}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html