diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-04-24 11:06:08 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-01 12:15:06 -0700 |
commit | daae19224a05be9efb9a39c2a2c1c9a60fe906f1 (patch) | |
tree | 0c42e685da0c4cddf132ebf0bd829ace28585ea5 /t/t1450-fsck.sh | |
parent | d599e0484f8ebac8cc50e9557a4c3d246826843d (diff) | |
download | git-daae19224a05be9efb9a39c2a2c1c9a60fe906f1.tar.gz git-daae19224a05be9efb9a39c2a2c1c9a60fe906f1.tar.xz |
fsck: check ident lines in commit objects
Check that email addresses do not contain <, >, or newline so they can
be quickly scanned without trouble. The copy() function in ident.c
already ensures that ordinary git commands will not write email
addresses without this property.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1450-fsck.sh')
-rwxr-xr-x | t/t1450-fsck.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 49cae3ed5..22a80c826 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -57,6 +57,34 @@ test_expect_success 'branch pointing to non-commit' ' git update-ref -d refs/heads/invalid ' +new=nothing +test_expect_success 'email without @ is okay' ' + git cat-file commit HEAD >basis && + sed "s/@/AT/" basis >okay && + new=$(git hash-object -t commit -w --stdin <okay) && + echo "$new" && + git update-ref refs/heads/bogus "$new" && + git fsck 2>out && + cat out && + ! grep "error in commit $new" out +' +git update-ref -d refs/heads/bogus +rm -f ".git/objects/$new" + +new=nothing +test_expect_success 'email with embedded > is not okay' ' + git cat-file commit HEAD >basis && + sed "s/@[a-z]/&>/" basis >bad-email && + new=$(git hash-object -t commit -w --stdin <bad-email) && + echo "$new" && + git update-ref refs/heads/bogus "$new" && + git fsck 2>out && + cat out && + grep "error in commit $new" out +' +git update-ref -d refs/heads/bogus +rm -f ".git/objects/$new" + cat > invalid-tag <<EOF object ffffffffffffffffffffffffffffffffffffffff type commit |