blob: 2a2cf91352037b6f2c238237474aa1d78928f5ad [file] [log] [blame]
Christian Couder296c6bb2010-05-26 04:50:12 +02001#!/bin/sh
2#
3# Copyright (c) 2010 Jakub Narebski, Christian Couder
4#
5
6test_description='Move a binary file'
7
8. ./test-lib.sh
9
10
11test_expect_success 'prepare repository' '
12 git init &&
13 echo foo > foo &&
14 echo "barQ" | q_to_nul > bar &&
15 git add . &&
16 git commit -m "Initial commit"
17'
18
19test_expect_success 'move the files into a "sub" directory' '
20 mkdir sub &&
21 git mv bar foo sub/ &&
22 git commit -m "Moved to sub/"
23'
24
25cat > expected <<\EOF
Jonathan Nieder6dd88832012-03-13 00:05:54 -050026- - bar => sub/bar
270 0 foo => sub/foo
Christian Couder296c6bb2010-05-26 04:50:12 +020028
29diff --git a/bar b/sub/bar
30similarity index 100%
31rename from bar
32rename to sub/bar
33diff --git a/foo b/sub/foo
34similarity index 100%
35rename from foo
36rename to sub/foo
37EOF
38
39test_expect_success 'git show -C -C report renames' '
Jonathan Nieder6dd88832012-03-13 00:05:54 -050040 git show -C -C --raw --binary --numstat >patch-with-stat &&
41 tail -n 11 patch-with-stat >current &&
Christian Couder296c6bb2010-05-26 04:50:12 +020042 test_cmp expected current
43'
44
45test_done