Skip to content

Commit dfab71c

Browse files
andyparkinsJunio C Hamano
authored andcommitted
Add test case for $Id$ expanded in the repository
This test case would have caught the bug fixed by revision c23290d. It puts various forms of $Id$ into a file in the repository, without allowing git to collapse them to uniformity. Then enables the $Id$ expansion on checkout, and checks that what is checked out has coped with the various forms. Signed-off-by: Andy Parkins <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cdd5b82 commit dfab71c

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

t/t0021-conversion.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,40 @@ test_expect_success check '
4545
test "z$id" = "z$embedded"
4646
'
4747

48+
# If an expanded ident ever gets into the repository, we want to make sure that
49+
# it is collapsed before being expanded again on checkout
50+
test_expect_success expanded_in_repo '
51+
{
52+
echo "File with expanded keywords"
53+
echo "\$Id\$"
54+
echo "\$Id:\$"
55+
echo "\$Id: 0000000000000000000000000000000000000000 \$"
56+
echo "\$Id: NoSpaceAtEnd\$"
57+
echo "\$Id:NoSpaceAtFront \$"
58+
echo "\$Id:NoSpaceAtEitherEnd\$"
59+
echo "\$Id: NoTerminatingSymbol"
60+
} > expanded-keywords &&
61+
62+
{
63+
echo "File with expanded keywords"
64+
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
65+
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
66+
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
67+
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
68+
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
69+
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
70+
echo "\$Id: NoTerminatingSymbol"
71+
} > expected-output &&
72+
73+
git add expanded-keywords &&
74+
git commit -m "File with keywords expanded" &&
75+
76+
echo "expanded-keywords ident" >> .gitattributes &&
77+
78+
rm -f expanded-keywords &&
79+
git checkout -- expanded-keywords &&
80+
cat expanded-keywords &&
81+
cmp expanded-keywords expected-output
82+
'
83+
4884
test_done

0 commit comments

Comments
 (0)