Git fork
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

at reftables-rust 99 lines 2.7 kB view raw
1#!/bin/sh 2# 3# Copyright (c) 2005 Junio C Hamano 4# 5 6test_description='Same rename detection as t4003 but testing diff-raw -z. 7 8' 9 10. ./test-lib.sh 11. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash 12 13test_expect_success \ 14 'prepare reference tree' \ 15 'COPYING_test_data >COPYING && 16 echo frotz >rezrov && 17 git update-index --add COPYING rezrov && 18 orig=$(git hash-object COPYING) && 19 tree=$(git write-tree) && 20 echo $tree' 21 22test_expect_success \ 23 'prepare work tree' \ 24 'sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 && 25 sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 && 26 rm -f COPYING && 27 c1=$(git hash-object COPYING.1) && 28 c2=$(git hash-object COPYING.2) && 29 git update-index --add --remove COPYING COPYING.?' 30 31# tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2, 32# both are slightly edited, and unchanged rezrov. We say COPYING.1 33# and COPYING.2 are based on COPYING, and do not say anything about 34# rezrov. 35 36git diff-index -z -C $tree >current 37 38cat >expected <<EOF 39:100644 100644 $orig $c1 C1234 40COPYING 41COPYING.1 42:100644 100644 $orig $c2 R1234 43COPYING 44COPYING.2 45EOF 46 47test_expect_success \ 48 'validate output from rename/copy detection (#1)' \ 49 'compare_diff_raw_z current expected' 50 51################################################################ 52 53test_expect_success \ 54 'prepare work tree again' \ 55 'mv COPYING.2 COPYING && 56 git update-index --add --remove COPYING COPYING.1 COPYING.2' 57 58# tree has COPYING and rezrov. work tree has COPYING and COPYING.1, 59# both are slightly edited, and unchanged rezrov. We say COPYING.1 60# is based on COPYING and COPYING is still there, and do not say anything 61# about rezrov. 62 63git diff-index -z -C $tree >current 64cat >expected <<EOF 65:100644 100644 $orig $c2 M 66COPYING 67:100644 100644 $orig $c1 C1234 68COPYING 69COPYING.1 70EOF 71 72test_expect_success \ 73 'validate output from rename/copy detection (#2)' \ 74 'compare_diff_raw_z current expected' 75 76################################################################ 77 78# tree has COPYING and rezrov. work tree has the same COPYING and 79# copy-edited COPYING.1, and unchanged rezrov. We should not say 80# anything about rezrov or COPYING, since the revised again diff-raw 81# nows how to say Copy. 82 83test_expect_success \ 84 'prepare work tree once again' \ 85 'COPYING_test_data >COPYING && 86 git update-index --add --remove COPYING COPYING.1' 87 88git diff-index -z -C --find-copies-harder $tree >current 89cat >expected <<EOF 90:100644 100644 $orig $c1 C1234 91COPYING 92COPYING.1 93EOF 94 95test_expect_success \ 96 'validate output from rename/copy detection (#3)' \ 97 'compare_diff_raw_z current expected' 98 99test_done