File: t4044-diff-index-unique-abbrev.sh

package info (click to toggle)
cgit 0.10.2.git2.0.1-3%2Bdeb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 26,640 kB
  • ctags: 19,675
  • sloc: ansic: 159,238; sh: 129,259; perl: 29,890; tcl: 21,214; python: 5,362; makefile: 3,295; lisp: 1,786; php: 120; asm: 98; csh: 45
file content (35 lines) | stat: -rwxr-xr-x 767 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

test_description='test unique sha1 abbreviation on "index from..to" line'
. ./test-lib.sh

cat >expect_initial <<EOF
100644 blob 51d2738463ea4ca66f8691c91e33ce64b7d41bb1	foo
EOF

cat >expect_update <<EOF
100644 blob 51d2738efb4ad8a1e40bed839ab8e116f0a15e47	foo
EOF

test_expect_success 'setup' '
	echo 4827 > foo &&
	git add foo &&
	git commit -m "initial" &&
	git cat-file -p HEAD: > actual &&
	test_cmp expect_initial actual &&
	echo 11742 > foo &&
	git commit -a -m "update" &&
	git cat-file -p HEAD: > actual &&
	test_cmp expect_update actual
'

cat >expect <<EOF
index 51d27384..51d2738e 100644
EOF

test_expect_success 'diff does not produce ambiguous index line' '
	git diff HEAD^..HEAD | grep index > actual &&
	test_cmp expect actual
'

test_done