summaryrefslogtreecommitdiff
path: root/t/t4011-diff-symlink.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-01-30 16:03:10 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-01-30 16:03:10 -0800
commit00d3278c8534a8244ae3447189401111e017fd5d (patch)
treef1c19903bc10ffe4816642040080fb6cfd5da376 /t/t4011-diff-symlink.sh
parentt6000lib: Fix permission (diff)
parentAdd a small patch-mode testing library (diff)
downloadtgif-00d3278c8534a8244ae3447189401111e017fd5d.tar.xz
Merge commit 'b319ef7' into jc/maint-fix-test-perm
* commit 'b319ef7': (8132 commits) Add a small patch-mode testing library git-apply--interactive: Refactor patch mode code t8005: Nobody writes Russian in shift_jis Fix severe breakage in "git-apply --whitespace=fix" Update release notes for 1.6.4 After renaming a section, print any trailing variable definitions Make section_name_match start on '[', and return the length on success send-email: detect cycles in alias expansion Show the presence of untracked files in the bash prompt. SunOS grep does not understand -C<n> nor -e Fix export_marks() error handling. git repack: keep commits hidden by a graft Add a test showing that 'git repack' throws away grafted-away parents git branch: clean up detached branch handling git branch: avoid unnecessary object lookups git branch: fix performance problem git svn: fix shallow clone when upstream revision is too new do_one_ref(): null_sha1 check is not about broken ref configure.ac: properly unset NEEDS_SSL_WITH_CRYPTO when sha1 func is missing janitor: useless checks before free ...
Diffstat (limited to 't/t4011-diff-symlink.sh')
-rwxr-xr-xt/t4011-diff-symlink.sh35
1 files changed, 24 insertions, 11 deletions
diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh
index 379a831f0b..d7e327cc5b 100755
--- a/t/t4011-diff-symlink.sh
+++ b/t/t4011-diff-symlink.sh
@@ -7,7 +7,13 @@ test_description='Test diff of symlinks.
'
. ./test-lib.sh
-. ../diff-lib.sh
+. "$TEST_DIRECTORY"/diff-lib.sh
+
+if ! test_have_prereq SYMLINKS
+then
+ say 'Symbolic links not supported, skipping tests.'
+ test_done
+fi
cat > expected << EOF
diff --git a/frotz b/frotz
@@ -23,17 +29,17 @@ EOF
test_expect_success \
'diff new symlink' \
'ln -s xyzzy frotz &&
- git-update-index &&
- tree=$(git-write-tree) &&
- git-update-index --add frotz &&
- GIT_DIFF_OPTS=--unified=0 git-diff-index -M -p $tree > current &&
+ git update-index &&
+ tree=$(git write-tree) &&
+ git update-index --add frotz &&
+ GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree > current &&
compare_diff_patch current expected'
test_expect_success \
'diff unchanged symlink' \
- 'tree=$(git-write-tree) &&
- git-update-index frotz &&
- test -z "$(git-diff-index --name-only $tree)"'
+ 'tree=$(git write-tree) &&
+ git update-index frotz &&
+ test -z "$(git diff-index --name-only $tree)"'
cat > expected << EOF
diff --git a/frotz b/frotz
@@ -49,7 +55,7 @@ EOF
test_expect_success \
'diff removed symlink' \
'rm frotz &&
- git-diff-index -M -p $tree > current &&
+ git diff-index -M -p $tree > current &&
compare_diff_patch current expected'
cat > expected << EOF
@@ -60,7 +66,7 @@ test_expect_success \
'diff identical, but newly created symlink' \
'sleep 3 &&
ln -s xyzzy frotz &&
- git-diff-index -M -p $tree > current &&
+ git diff-index -M -p $tree > current &&
compare_diff_patch current expected'
cat > expected << EOF
@@ -79,7 +85,14 @@ test_expect_success \
'diff different symlink' \
'rm frotz &&
ln -s yxyyz frotz &&
- git-diff-index -M -p $tree > current &&
+ git diff-index -M -p $tree > current &&
compare_diff_patch current expected'
+test_expect_success \
+ 'diff symlinks with non-existing targets' \
+ 'ln -s narf pinky &&
+ ln -s take\ over brain &&
+ test_must_fail git diff --no-index pinky brain > output 2> output.err &&
+ grep narf output &&
+ ! grep error output.err'
test_done