From c8bae7493d2f2910b57f13ded012e86bdcfb0532 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 16:47:53 +0200 Subject: Adding upstream version 1:2.39.2. Signed-off-by: Daniel Baumann --- t/t4009-diff-rename-4.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100755 t/t4009-diff-rename-4.sh (limited to 't/t4009-diff-rename-4.sh') diff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh new file mode 100755 index 0000000..3480781 --- /dev/null +++ b/t/t4009-diff-rename-4.sh @@ -0,0 +1,100 @@ +#!/bin/sh +# +# Copyright (c) 2005 Junio C Hamano +# + +test_description='Same rename detection as t4003 but testing diff-raw -z. + +' + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh +. "$TEST_DIRECTORY"/lib-diff.sh ;# test-lib chdir's into trash + +test_expect_success \ + 'prepare reference tree' \ + 'COPYING_test_data >COPYING && + echo frotz >rezrov && + git update-index --add COPYING rezrov && + orig=$(git hash-object COPYING) && + tree=$(git write-tree) && + echo $tree' + +test_expect_success \ + 'prepare work tree' \ + 'sed -e 's/HOWEVER/However/' COPYING.1 && + sed -e 's/GPL/G.P.L/g' COPYING.2 && + rm -f COPYING && + c1=$(git hash-object COPYING.1) && + c2=$(git hash-object COPYING.2) && + git update-index --add --remove COPYING COPYING.?' + +# tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2, +# both are slightly edited, and unchanged rezrov. We say COPYING.1 +# and COPYING.2 are based on COPYING, and do not say anything about +# rezrov. + +git diff-index -z -C $tree >current + +cat >expected <current +cat >expected <COPYING && + git update-index --add --remove COPYING COPYING.1' + +git diff-index -z -C --find-copies-harder $tree >current +cat >expected <