t / t4206-log-follow-harder-copies.shon commit Merge branch 'nd/clone-linked-checkout' (b9d23c2)
   1#!/bin/sh
   2#
   3# Copyright (c) 2010 Bo Yang
   4#
   5
   6test_description='Test --follow should always find copies hard in git log.
   7
   8'
   9. ./test-lib.sh
  10. "$TEST_DIRECTORY"/diff-lib.sh
  11
  12echo >path0 'Line 1
  13Line 2
  14Line 3
  15'
  16
  17test_expect_success \
  18    'add a file path0 and commit.' \
  19    'git add path0 &&
  20     git commit -m "Add path0"'
  21
  22echo >path0 'New line 1
  23New line 2
  24New line 3
  25'
  26test_expect_success \
  27    'Change path0.' \
  28    'git add path0 &&
  29     git commit -m "Change path0"'
  30
  31cat <path0 >path1
  32test_expect_success \
  33    'copy path0 to path1.' \
  34    'git add path1 &&
  35     git commit -m "Copy path1 from path0"'
  36
  37test_expect_success \
  38    'find the copy path0 -> path1 harder' \
  39    'git log --follow --name-status --pretty="format:%s"  path1 > current'
  40
  41cat >expected <<\EOF
  42Copy path1 from path0
  43C100    path0   path1
  44
  45Change path0
  46M       path0
  47
  48Add path0
  49A       path0
  50EOF
  51
  52test_expect_success \
  53    'validate the output.' \
  54    'compare_diff_patch current expected'
  55
  56test_done