t / t4004-diff-rename-symlink.shon commit Update tutorial. (914328a)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='More rename detection tests.
   7
   8The rename detection logic should be able to detect pure rename or
   9copy of symbolic links, but should not produce rename/copy followed
  10by an edit for them.
  11'
  12. ./test-lib.sh
  13
  14test_expect_success \
  15    'prepare reference tree' \
  16    'echo xyzzy | tr -d '\\\\'012 >yomin &&
  17     ln -s xyzzy frotz &&
  18    git-update-cache --add frotz yomin &&
  19    tree=$(git-write-tree) &&
  20    echo $tree'
  21
  22test_expect_success \
  23    'prepare work tree' \
  24    'mv frotz rezrov &&
  25     rm -f yomin &&
  26     ln -s xyzzy nitfol &&
  27     ln -s xzzzy bozbar &&
  28    git-update-cache --add --remove frotz rezrov nitfol bozbar yomin'
  29
  30# tree has frotz pointing at xyzzy, and yomin that contains xyzzy to
  31# confuse things.  work tree has rezrov (xyzzy) nitfol (xyzzy) and
  32# bozbar (xzzzy).
  33# rezrov and nitfol are rename/copy of frotz and bozbar should be
  34# a new creation.
  35
  36GIT_DIFF_OPTS=--unified=0 git-diff-cache -M -p $tree >current
  37cat >expected <<\EOF
  38diff --git a/bozbar b/bozbar
  39new file mode 120000
  40--- /dev/null
  41+++ b/bozbar
  42@@ -0,0 +1 @@
  43+xzzzy
  44\ No newline at end of file
  45diff --git a/frotz b/nitfol
  46similarity index 100%
  47copy from frotz
  48copy to nitfol
  49diff --git a/frotz b/rezrov
  50similarity index 100%
  51rename from frotz
  52rename to rezrov
  53diff --git a/yomin b/yomin
  54deleted file mode 100644
  55--- a/yomin
  56+++ /dev/null
  57@@ -1 +0,0 @@
  58-xyzzy
  59\ No newline at end of file
  60EOF
  61
  62test_expect_success \
  63    'validate diff output' \
  64    'diff -u current expected'
  65
  66test_done