@@ -8,15 +8,15 @@ test_description='git update-index --again test.
8
8
9
9
. ./test-lib.sh
10
10
11
- cat > expected << \EOF
12
- 100644 3b18e512dba79e4c8300dd08aeb37f8e728b8dad 0 file1
13
- 100644 9db8893856a8a02eaa73470054b7c1c5a7c82e47 0 file2
14
- EOF
15
11
test_expect_success ' update-index --add' '
16
12
echo hello world >file1 &&
17
13
echo goodbye people >file2 &&
18
14
git update-index --add file1 file2 &&
19
15
git ls-files -s >current &&
16
+ cat >expected <<-EOF &&
17
+ 100644 $(git hash-object file1) 0 file1
18
+ 100644 $(git hash-object file2) 0 file2
19
+ EOF
20
20
cmp current expected
21
21
'
22
22
@@ -34,21 +34,17 @@ test_expect_success 'update-index --again' '
34
34
cmp current expected
35
35
'
36
36
37
- cat > expected << \EOF
38
- 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
39
- EOF
40
37
test_expect_success ' update-index --remove --again' '
41
38
git update-index --remove --again &&
42
39
git ls-files -s >current &&
40
+ cat >expected <<-EOF &&
41
+ 100644 $(git hash-object file2) 0 file2
42
+ EOF
43
43
cmp current expected
44
44
'
45
45
46
46
test_expect_success ' first commit' ' git commit -m initial'
47
47
48
- cat > expected << \EOF
49
- 100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0 dir1/file3
50
- 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
51
- EOF
52
48
test_expect_success ' update-index again' '
53
49
mkdir -p dir1 &&
54
50
echo hello world >dir1/file3 &&
@@ -58,32 +54,37 @@ test_expect_success 'update-index again' '
58
54
echo happy >dir1/file3 &&
59
55
git update-index --again &&
60
56
git ls-files -s >current &&
57
+ cat >expected <<-EOF &&
58
+ 100644 $(git hash-object dir1/file3) 0 dir1/file3
59
+ 100644 $(git hash-object file2) 0 file2
60
+ EOF
61
61
cmp current expected
62
62
'
63
63
64
- cat > expected << \EOF
65
- 100644 d7fb3f695f06c759dbf3ab00046e7cc2da22d10f 0 dir1/file3
66
- 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
67
- EOF
64
+ file2=$( git hash-object file2)
68
65
test_expect_success ' update-index --update from subdir' '
69
66
echo not so happy >file2 &&
70
67
(cd dir1 &&
71
68
cat ../file2 >file3 &&
72
69
git update-index --again
73
70
) &&
74
71
git ls-files -s >current &&
75
- cmp current expected
72
+ cat >expected <<-EOF &&
73
+ 100644 $(git hash-object dir1/file3) 0 dir1/file3
74
+ 100644 $file2 0 file2
75
+ EOF
76
+ test_cmp current expected
76
77
'
77
78
78
- cat > expected << \EOF
79
- 100644 594fb5bb1759d90998e2bf2a38261ae8e243c760 0 dir1/file3
80
- 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2
81
- EOF
82
79
test_expect_success ' update-index --update with pathspec' '
83
80
echo very happy >file2 &&
84
81
cat file2 >dir1/file3 &&
85
82
git update-index --again dir1/ &&
86
83
git ls-files -s >current &&
84
+ cat >expected <<-EOF &&
85
+ 100644 $(git hash-object dir1/file3) 0 dir1/file3
86
+ 100644 $file2 0 file2
87
+ EOF
87
88
cmp current expected
88
89
'
89
90
0 commit comments