]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4001-diff-rename.sh
avoid echo -e, there are systems where it does not work
[thirdparty/git.git] / t / t4001-diff-rename.sh
CommitLineData
5c97558c
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='Test rename detection in diff engine.
7
8'
9. ./test-lib.sh
ec1fcc16 10. ../diff-lib.sh
5c97558c
JH
11
12echo >path0 'Line 1
13Line 2
14Line 3
15Line 4
16Line 5
17Line 6
18Line 7
19Line 8
20Line 9
21Line 10
22line 11
23Line 12
24Line 13
25Line 14
26Line 15
27'
28
29test_expect_success \
30 'update-cache --add a file.' \
215a7ad1 31 'git-update-index --add path0'
5c97558c
JH
32
33test_expect_success \
34 'write that tree.' \
427dcb4b 35 'tree=$(git-write-tree) && echo $tree'
5c97558c
JH
36
37sed -e 's/line/Line/' <path0 >path1
38rm -f path0
39test_expect_success \
40 'renamed and edited the file.' \
215a7ad1 41 'git-update-index --add --remove path0 path1'
5c97558c
JH
42
43test_expect_success \
215a7ad1
JH
44 'git-diff-index -p -M after rename and editing.' \
45 'git-diff-index -p -M $tree >current'
5c97558c
JH
46cat >expected <<\EOF
47diff --git a/path0 b/path1
dc938417
LT
48rename from path0
49rename to path1
5c97558c
JH
50--- a/path0
51+++ b/path1
52@@ -8,7 +8,7 @@ Line 7
53 Line 8
54 Line 9
55 Line 10
56-line 11
57+Line 11
58 Line 12
59 Line 13
60 Line 14
61EOF
57fe64a4
JH
62
63test_expect_success \
64 'validate the output.' \
ec1fcc16 65 'compare_diff_patch current expected'
57fe64a4
JH
66
67test_done