t2107: test 'git update-index --verbose'
The '--verbose' option reports what is being added and removed from the index, but has not been tested up to this point. Augment the tests in t2107 to check the '--verbose' option in some scenarios. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Jun 16, 2022 at 13:13 UTC
624b8cfdcea32e4f023415097e611fb1566512fd
1 file changed
+25
-6
t/t2107-update-index-basic.sh
+25
-6
@@ -36,9 +36,14 @@ test_expect_success '--cacheinfo does not accept blob null sha1' '
36
echo content >file &&
37
git add file &&
38
git rev-parse :file >expect &&
39
- test_must_fail git update-index --cacheinfo 100644 $ZERO_OID file &&
39
+ test_must_fail git update-index --verbose --cacheinfo 100644 $ZERO_OID file >out &&
40
git rev-parse :file >actual &&
41
- test_cmp expect actual
41
+ test_cmp expect actual &&
42
+
43
+ cat >expect <<-\EOF &&
44
+ add '\''file'\''
45
+ EOF
46
+ test_cmp expect out
47
'
48
49
test_expect_success '--cacheinfo does not accept gitlink null sha1' '
@@ -59,9 +64,14 @@ test_expect_success '--cacheinfo mode,sha1,path (new syntax)' '
64
git rev-parse :file >actual &&
65
test_cmp expect actual &&
66
62
- git update-index --add --cacheinfo "100644,$(cat expect),elif" &&
67
+ git update-index --add --verbose --cacheinfo "100644,$(cat expect),elif" >out &&
68
git rev-parse :elif >actual &&
64
- test_cmp expect actual
69
+ test_cmp expect actual &&
70
+
71
+ cat >expect <<-\EOF &&
72
+ add '\''elif'\''
73
+ EOF
74
+ test_cmp expect out
75
'
76
77
test_expect_success '.lock files cleaned up' '
@@ -74,7 +84,8 @@ test_expect_success '.lock files cleaned up' '
84
git config core.worktree ../../worktree &&
85
# --refresh triggers late setup_work_tree,
86
# active_cache_changed is zero, rollback_lock_file fails
77
- git update-index --refresh &&
87
+ git update-index --refresh --verbose >out &&
88
+ test_must_be_empty out &&
89
! test -f .git/index.lock
90
)
91
'
@@ -83,7 +94,15 @@ test_expect_success '--chmod=+x and chmod=-x in the same argument list' '
94
>A &&
95
>B &&
96
git add A B &&
86
- git update-index --chmod=+x A --chmod=-x B &&
97
+ git update-index --verbose --chmod=+x A --chmod=-x B >out &&
98
+ cat >expect <<-\EOF &&
99
+ add '\''A'\''
100
+ chmod +x '\''A'\''
101
+ add '\''B'\''
102
+ chmod -x '\''B'\''
103
+ EOF
104
+ test_cmp expect out &&
105
+
106
cat >expect <<-EOF &&
107
100755 $EMPTY_BLOB 0 A
108
100644 $EMPTY_BLOB 0 B