Skip to content

Commit 624b8cf

Browse files
derrickstoleegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8168d5e commit 624b8cf

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

t/t2107-update-index-basic.sh

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@ test_expect_success '--cacheinfo does not accept blob null sha1' '
3636
echo content >file &&
3737
git add file &&
3838
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 &&
4040
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
4247
'
4348

4449
test_expect_success '--cacheinfo does not accept gitlink null sha1' '
@@ -59,9 +64,14 @@ test_expect_success '--cacheinfo mode,sha1,path (new syntax)' '
5964
git rev-parse :file >actual &&
6065
test_cmp expect actual &&
6166
62-
git update-index --add --cacheinfo "100644,$(cat expect),elif" &&
67+
git update-index --add --verbose --cacheinfo "100644,$(cat expect),elif" >out &&
6368
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
6575
'
6676

6777
test_expect_success '.lock files cleaned up' '
@@ -74,7 +84,8 @@ test_expect_success '.lock files cleaned up' '
7484
git config core.worktree ../../worktree &&
7585
# --refresh triggers late setup_work_tree,
7686
# 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 &&
7889
! test -f .git/index.lock
7990
)
8091
'
@@ -83,7 +94,15 @@ test_expect_success '--chmod=+x and chmod=-x in the same argument list' '
8394
>A &&
8495
>B &&
8596
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+
87106
cat >expect <<-EOF &&
88107
100755 $EMPTY_BLOB 0 A
89108
100644 $EMPTY_BLOB 0 B

0 commit comments

Comments
 (0)