diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2014-09-11 16:26:41 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-11 14:19:09 -0700 |
commit | 90e3e5f0574480cb873cca1c7b968dd1516c05d2 (patch) | |
tree | ae07b50d582c96bb81d64db6db7179f00289642b /Documentation/git-filter-branch.txt | |
parent | fsck: check tag objects' headers (diff) | |
download | tgif-90e3e5f0574480cb873cca1c7b968dd1516c05d2.tar.xz |
Add regression tests for stricter tag fsck'ing
The intent of the new test case is to catch general breakages in
the fsck_tag() function, not so much to test it extensively, trying to
strike the proper balance between thoroughness and speed.
While it *would* have been nice to test the code path where fsck_object()
encounters an invalid tag object, this is not possible using git fsck: tag
objects are parsed already before fsck'ing (and the parser already fails
upon such objects).
Even worse: we would not even be able write out invalid tag objects
because git hash-object parses those objects, too, unless we resorted to
really ugly hacks such as using something like this in the unit tests
(essentially depending on Perl *and* Compress::Zlib):
hash_invalid_object () {
contents="$(printf '%s %d\0%s' "$1" ${#2} "$2")" &&
sha1=$(echo "$contents" | test-sha1) &&
suffix=${sha1#??} &&
mkdir -p .git/objects/${sha1%$suffix} &&
echo "$contents" |
perl -MCompress::Zlib -e 'undef $/; print compress(<>)' \
> .git/objects/${sha1%$suffix}/$suffix &&
echo $sha1
}
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-filter-branch.txt')
0 files changed, 0 insertions, 0 deletions