* [PATCH] t/test-lib.sh: resolve symlinks in working directory, for pathname comparisons
@ 2008-05-31 21:11 Lea Wiemann
0 siblings, 0 replies; only message in thread
From: Lea Wiemann @ 2008-05-31 21:11 UTC (permalink / raw)
To: git; +Cc: Lea Wiemann
Without this, some tests will fail because they compare command output
of subprocesses (such as git) with $PWD -- but subprocesses have the
physical path as their working directory, whereas $PWD contains the
symlinked path. This fixes it.
Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
---
Here is how to reproduce it:
$ ln -s /path/to/git git-symlink
$ cd git-symlink/t
$ ./t0001-init.sh
* ok 1: plain
* ok 2: plain with GIT_WORK_TREE
* ok 3: plain bare
* ok 4: plain bare with GIT_WORK_TREE
* ok 5: GIT_DIR bare
* ok 6: GIT_DIR non-bare
* FAIL 7: GIT_DIR & GIT_WORK_TREE (1)
(
unset GIT_CONFIG
mkdir git-dir-wt-1.git &&
GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init
) &&
check_config git-dir-wt-1.git false "$(pwd)"
* ok 8: GIT_DIR & GIT_WORK_TREE (2)
* ok 9: reinit
* failed 1 among 9 test(s)
With this patch applied, all tests work fine in symlinked working
directories.
t/test-lib.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3bf570b..7a8bd27 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -419,7 +419,9 @@ rm -fr "$test" || {
}
test_create_repo "$test"
-cd "$test" || exit 1
+# 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
this_test=$(expr "./$0" : '.*/\(t[0-9]*\)-[^/]*$')
for skp in $GIT_SKIP_TESTS
--
1.5.5.GIT
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-05-31 21:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-31 21:11 [PATCH] t/test-lib.sh: resolve symlinks in working directory, for pathname comparisons Lea Wiemann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).