From cb0ad0c0af084b52a72791feeca7c70bd8ed855a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 19 Sep 2006 15:11:29 +0200 Subject: [PATCH] fix t0000 for absence of symlinks --- Makefile | 2 ++ t/Makefile | 4 ++++ t/t0000-basic.sh | 32 ++++++++++++++++++++++++++++---- t/test-lib.sh | 2 ++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 105e2d1b6e..3144430a97 100644 --- a/Makefile +++ b/Makefile @@ -428,6 +428,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) NO_STRLCPY=YesPlease NO_ICONV=YesPlease NO_C99_FORMAT = YesPlease + NO_SYMLINKS=YesPlease NO_SVN_TESTS=YesPlease COMPAT_CFLAGS += -DNO_ETC_PASSWD -DNO_ST_BLOCKS -DSTRIP_EXTENSION=\".exe\" -I compat COMPAT_OBJS += compat/mingw.o compat/fnmatch.o @@ -832,6 +833,7 @@ GIT-CFLAGS: .FORCE-GIT-CFLAGS # However, the environment gets quite big, and some programs have problems # with that. +export NO_SYMLINKS export NO_SVN_TESTS test: all diff --git a/t/Makefile b/t/Makefile index 19e38508a7..8cca7120ce 100644 --- a/t/Makefile +++ b/t/Makefile @@ -13,6 +13,10 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh) TSVN = $(wildcard t91[0-9][0-9]-*.sh) +ifdef NO_SYMLINKS + GIT_TEST_OPTS += --no-symlinks +endif + all: $(T) clean $(T): diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 186de70243..81ec70ff93 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -30,6 +30,22 @@ fi . ./test-lib.sh +test "$no_symlinks" && { + DIFF=$(which diff) + + function diff () { + opt= + case "$1" in -*) opt=$1; shift;; esac + tr -d "\015" < $1 > $1.doof + grep -v "^:\?120000" < $2 | \ + sed -e s/58a09c23e2ca152193f2786e06986b7b6712bdbe/600f42758e4458c37c2c1f8063378f540b4efad7/ \ + -e s/21ae8269cacbe57ae09138dcc3a2887f904d02b3/cfb8591b2f65de8b8cc1020cd7d9e67e7793b325/ \ + -e s/3c5e5399f3a333eddecce7a9b9465b63f65f51e2/ce580448f0148b985a513b693fdf7d802cacb44f/ \ + > $2.doof + $DIFF $opt $1.doof $2.doof + } +} + ################################################################ # git-init has been done in an empty repository. # make sure it is empty. @@ -113,6 +129,7 @@ cat >expected <<\EOF 100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0 path3/subp3/file3 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0 path3/subp3/file3sym EOF + test_expect_success \ 'validate git-ls-files output for a known tree.' \ 'diff current expected' @@ -120,9 +137,11 @@ test_expect_success \ test_expect_success \ 'writing tree out with git-write-tree.' \ 'tree=$(git-write-tree)' +expected_tree=087704a96baf1c2d1c869a8b084481e121c88b5b +test "$no_symlinks" && expected_tree=8e18edf7d7edcf4371a3ac6ae5f07c2641db7c46 test_expect_success \ 'validate object ID for a known tree.' \ - 'test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b' + 'test "$tree" = "$expected_tree"' test_expect_success \ 'showing tree with git-ls-tree' \ @@ -180,16 +199,20 @@ test_expect_success \ test_expect_success \ 'writing partial tree out with git-write-tree --prefix.' \ 'ptree=$(git-write-tree --prefix=path3)' +expected_tree=21ae8269cacbe57ae09138dcc3a2887f904d02b3 +test "$no_symlinks" && expected_tree=cfb8591b2f65de8b8cc1020cd7d9e67e7793b325 test_expect_success \ 'validate object ID for a known tree.' \ - 'test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3' + 'test "$ptree" = "$expected_tree"' test_expect_success \ 'writing partial tree out with git-write-tree --prefix.' \ 'ptree=$(git-write-tree --prefix=path3/subp3)' +expect_tree=3c5e5399f3a333eddecce7a9b9465b63f65f51e2 +test "$no_symlinks" && expect_tree=ce580448f0148b985a513b693fdf7d802cacb44f test_expect_success \ 'validate object ID for a known tree.' \ - 'test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2' + 'test "$ptree" = "$expect_tree"' cat >badobjects <expected <<\EOF EOF test_expect_success \ 'validate git-diff-files output for a know cache/work tree state.' \ - 'git-diff-files >current && diff >/dev/null -b current expected' + 'git-diff-files >current && diff -b current expected' test_expect_success \ 'git-update-index --refresh should succeed.' \ @@ -246,6 +269,7 @@ test_expect_success \ ################################################################ P=087704a96baf1c2d1c869a8b084481e121c88b5b +test "$no_symlinks" && P=7bb943559a305bdd6bdee2cef6e5df2413c3d30a test_expect_success \ 'git-commit-tree records the correct tree in a commit.' \ 'commit0=$(echo NO | git-commit-tree $P) && diff --git a/t/test-lib.sh b/t/test-lib.sh index 8e3ee6cd7b..8bf0345ef6 100755 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -78,6 +78,8 @@ do --no-python) # noop now... shift ;; + --no-symlinks) + no_symlinks=t; shift ;; *) break ;; esac