@@ -102,4 +102,58 @@ test_expect_success 'setup for many rename source candidates' '
102
102
grep warning actual.err
103
103
'
104
104
105
+ test_expect_success ' rename pretty print with nothing in common' '
106
+ mkdir -p a/b/ &&
107
+ : >a/b/c &&
108
+ git add a/b/c &&
109
+ git commit -m "create a/b/c" &&
110
+ mkdir -p c/b/ &&
111
+ git mv a/b/c c/b/a &&
112
+ git commit -m "a/b/c -> c/b/a" &&
113
+ git diff -M --summary HEAD^ HEAD >output &&
114
+ test_i18ngrep " a/b/c => c/b/a " output &&
115
+ git diff -M --stat HEAD^ HEAD >output &&
116
+ test_i18ngrep " a/b/c => c/b/a " output
117
+ '
118
+
119
+ test_expect_success ' rename pretty print with common prefix' '
120
+ mkdir -p c/d &&
121
+ git mv c/b/a c/d/e &&
122
+ git commit -m "c/b/a -> c/d/e" &&
123
+ git diff -M --summary HEAD^ HEAD >output &&
124
+ test_i18ngrep " c/{b/a => d/e} " output &&
125
+ git diff -M --stat HEAD^ HEAD >output &&
126
+ test_i18ngrep " c/{b/a => d/e} " output
127
+ '
128
+
129
+ test_expect_success ' rename pretty print with common suffix' '
130
+ mkdir d &&
131
+ git mv c/d/e d/e &&
132
+ git commit -m "c/d/e -> d/e" &&
133
+ git diff -M --summary HEAD^ HEAD >output &&
134
+ test_i18ngrep " {c/d => d}/e " output &&
135
+ git diff -M --stat HEAD^ HEAD >output &&
136
+ test_i18ngrep " {c/d => d}/e " output
137
+ '
138
+
139
+ test_expect_success ' rename pretty print with common prefix and suffix' '
140
+ mkdir d/f &&
141
+ git mv d/e d/f/e &&
142
+ git commit -m "d/e -> d/f/e" &&
143
+ git diff -M --summary HEAD^ HEAD >output &&
144
+ test_i18ngrep " d/{ => f}/e " output &&
145
+ git diff -M --stat HEAD^ HEAD >output &&
146
+ test_i18ngrep " d/{ => f}/e " output
147
+ '
148
+
149
+ test_expect_success ' rename pretty print common prefix and suffix overlap' '
150
+ mkdir d/f/f &&
151
+ git mv d/f/e d/f/f/e &&
152
+ git commit -m "d/f/e d/f/f/e" &&
153
+ git diff -M --summary HEAD^ HEAD >output &&
154
+ test_i18ngrep " d/f/{ => f}/e " output &&
155
+ git diff -M --stat HEAD^ HEAD >output &&
156
+ test_i18ngrep " d/f/{ => f}/e " output
157
+ '
158
+
105
159
test_done
0 commit comments