Skip to content

Commit b8c0689

Browse files
peffgitster
authored andcommitted
t9351: derive anonymized tree checks from original repo
Our tests of the anonymized repo just hard-code the expected set of objects in the root and subdirectory trees. This makes them brittle to the test setup changing (e.g., adding new paths that need tested). Let's look at the original repo to compute our expected set of objects. Note that this isn't completely perfect (e.g., we still rely on there being only one tree in the root), but it does simplify later patches. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c9c318d commit b8c0689

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

t/t9351-fast-export-anonymize.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,18 @@ test_expect_success 'repo has original shape and timestamps' '
7171

7272
test_expect_success 'root tree has original shape' '
7373
# the output entries are not necessarily in the same
74-
# order, but we know at least that we will have one tree
75-
# and one blob, so just check the sorted order
76-
cat >expect <<-\EOF &&
77-
blob
78-
tree
79-
EOF
74+
# order, but we should at least have the same set of
75+
# object types.
76+
git -C .. ls-tree HEAD >orig-root &&
77+
cut -d" " -f2 <orig-root | sort >expect &&
8078
git ls-tree $other_branch >root &&
8179
cut -d" " -f2 <root | sort >actual &&
8280
test_cmp expect actual
8381
'
8482

8583
test_expect_success 'paths in subdir ended up in one tree' '
86-
cat >expect <<-\EOF &&
87-
blob
88-
blob
89-
EOF
84+
git -C .. ls-tree other:subdir >orig-subdir &&
85+
cut -d" " -f2 <orig-subdir | sort >expect &&
9086
tree=$(grep tree root | cut -f2) &&
9187
git ls-tree $other_branch:$tree >tree &&
9288
cut -d" " -f2 <tree >actual &&

0 commit comments

Comments
 (0)