Skip to content

Commit

Permalink
Add test case for $Id$ expanded in the repository
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
andyparkins authored and Junio C Hamano committed May 29, 2007
1 parent cdd5b82 commit dfab71c
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions t/t0021-conversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,40 @@ test_expect_success check '
test "z$id" = "z$embedded"
'

# If an expanded ident ever gets into the repository, we want to make sure that
# it is collapsed before being expanded again on checkout
test_expect_success expanded_in_repo '
{
echo "File with expanded keywords"
echo "\$Id\$"
echo "\$Id:\$"
echo "\$Id: 0000000000000000000000000000000000000000 \$"
echo "\$Id: NoSpaceAtEnd\$"
echo "\$Id:NoSpaceAtFront \$"
echo "\$Id:NoSpaceAtEitherEnd\$"
echo "\$Id: NoTerminatingSymbol"
} > expanded-keywords &&
{
echo "File with expanded keywords"
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
echo "\$Id: NoTerminatingSymbol"
} > expected-output &&
git add expanded-keywords &&
git commit -m "File with keywords expanded" &&
echo "expanded-keywords ident" >> .gitattributes &&
rm -f expanded-keywords &&
git checkout -- expanded-keywords &&
cat expanded-keywords &&
cmp expanded-keywords expected-output
'

test_done

0 comments on commit dfab71c

Please sign in to comment.