summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-03 18:01:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-03 18:01:18 (GMT)
commitb2f44feba593ed0c4294a6f9933c8a1b6f190e04 (patch)
tree3b3d19bc7fd5883a4cdf6e0bbf8cf161a63eeab9 /t
parentbe9cb560e31c76c00760dadb151b5e3059970586 (diff)
parent1335f732892601368876e0e41c9ea288c2ab18f3 (diff)
downloadgit-b2f44feba593ed0c4294a6f9933c8a1b6f190e04.zip
git-b2f44feba593ed0c4294a6f9933c8a1b6f190e04.tar.gz
git-b2f44feba593ed0c4294a6f9933c8a1b6f190e04.tar.bz2
Merge branch 'js/fsck-opt'
Allow ignoring fsck errors on specific set of known-to-be-bad objects, and also tweaking warning level of various kinds of non critical breakages reported. * js/fsck-opt: fsck: support ignoring objects in `git fsck` via fsck.skiplist fsck: git receive-pack: support excluding objects from fsck'ing fsck: introduce `git fsck --connectivity-only` fsck: support demoting errors to warnings fsck: document the new receive.fsck.<msg-id> options fsck: allow upgrading fsck warnings to errors fsck: optionally ignore specific fsck issues completely fsck: disallow demoting grave fsck errors to warnings fsck: add a simple test for receive.fsck.<msg-id> fsck: make fsck_tag() warn-friendly fsck: handle multiple authors in commits specially fsck: make fsck_commit() warn-friendly fsck: make fsck_ident() warn-friendly fsck: report the ID of the error/warning fsck (receive-pack): allow demoting errors to warnings fsck: offer a function to demote fsck errors to warnings fsck: provide a function to parse fsck message IDs fsck: introduce identifiers for fsck messages fsck: introduce fsck options
Diffstat (limited to 't')
-rwxr-xr-xt/t1450-fsck.sh37
-rwxr-xr-xt/t5302-pack-index.sh2
-rwxr-xr-xt/t5504-fetch-receive-strict.sh51
3 files changed, 87 insertions, 3 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index cfb32b6..956673b 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -231,8 +231,8 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
git fsck --tags 2>out &&
cat >expect <<-EOF &&
- warning in tag $tag: invalid '\''tag'\'' name: wrong name format
- warning in tag $tag: invalid format - expected '\''tagger'\'' line
+ warning in tag $tag: badTagName: invalid '\''tag'\'' name: wrong name format
+ warning in tag $tag: missingTaggerEntry: invalid format - expected '\''tagger'\'' line
EOF
test_cmp expect out
'
@@ -287,6 +287,17 @@ test_expect_success 'rev-list --verify-objects with bad sha1' '
grep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out
'
+test_expect_success 'force fsck to ignore double author' '
+ git cat-file commit HEAD >basis &&
+ sed "s/^author .*/&,&/" <basis | tr , \\n >multiple-authors &&
+ new=$(git hash-object -t commit -w --stdin <multiple-authors) &&
+ test_when_finished "remove_object $new" &&
+ git update-ref refs/heads/bogus "$new" &&
+ test_when_finished "git update-ref -d refs/heads/bogus" &&
+ test_must_fail git fsck &&
+ git -c fsck.multipleAuthors=ignore fsck
+'
+
_bz='\0'
_bz5="$_bz$_bz$_bz$_bz$_bz"
_bz20="$_bz5$_bz5$_bz5$_bz5"
@@ -420,4 +431,26 @@ test_expect_success 'fsck notices ref pointing to missing tag' '
test_must_fail git -C missing fsck
'
+test_expect_success 'fsck --connectivity-only' '
+ rm -rf connectivity-only &&
+ git init connectivity-only &&
+ (
+ cd connectivity-only &&
+ touch empty &&
+ git add empty &&
+ test_commit empty &&
+ empty=.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 &&
+ rm -f $empty &&
+ echo invalid >$empty &&
+ test_must_fail git fsck --strict &&
+ git fsck --strict --connectivity-only &&
+ tree=$(git rev-parse HEAD:) &&
+ suffix=${tree#??} &&
+ tree=.git/objects/${tree%$suffix}/$suffix &&
+ rm -f $tree &&
+ echo invalid >$tree &&
+ test_must_fail git fsck --strict --connectivity-only
+ )
+'
+
test_done
diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh
index 61bc8da..3dc5ec4 100755
--- a/t/t5302-pack-index.sh
+++ b/t/t5302-pack-index.sh
@@ -259,7 +259,7 @@ EOF
thirtyeight=${tag#??} &&
rm -f .git/objects/${tag%$thirtyeight}/$thirtyeight &&
git index-pack --strict tag-test-${pack1}.pack 2>err &&
- grep "^error:.* expected .tagger. line" err
+ grep "^warning:.* expected .tagger. line" err
'
test_done
diff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh
index 69ee13c..44f3d5f 100755
--- a/t/t5504-fetch-receive-strict.sh
+++ b/t/t5504-fetch-receive-strict.sh
@@ -115,4 +115,55 @@ test_expect_success 'push with transfer.fsckobjects' '
test_cmp exp act
'
+cat >bogus-commit <<\EOF
+tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
+author Bugs Bunny 1234567890 +0000
+committer Bugs Bunny <bugs@bun.ni> 1234567890 +0000
+
+This commit object intentionally broken
+EOF
+
+test_expect_success 'push with receive.fsck.skipList' '
+ commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
+ git push . $commit:refs/heads/bogus &&
+ rm -rf dst &&
+ git init dst &&
+ git --git-dir=dst/.git config receive.fsckObjects true &&
+ test_must_fail git push --porcelain dst bogus &&
+ git --git-dir=dst/.git config receive.fsck.skipList SKIP &&
+ echo $commit >dst/.git/SKIP &&
+ git push --porcelain dst bogus
+'
+
+test_expect_success 'push with receive.fsck.missingEmail=warn' '
+ commit="$(git hash-object -t commit -w --stdin <bogus-commit)" &&
+ git push . $commit:refs/heads/bogus &&
+ rm -rf dst &&
+ git init dst &&
+ git --git-dir=dst/.git config receive.fsckobjects true &&
+ test_must_fail git push --porcelain dst bogus &&
+ git --git-dir=dst/.git config \
+ receive.fsck.missingEmail warn &&
+ git push --porcelain dst bogus >act 2>&1 &&
+ grep "missingEmail" act &&
+ git --git-dir=dst/.git branch -D bogus &&
+ git --git-dir=dst/.git config --add \
+ receive.fsck.missingEmail ignore &&
+ git --git-dir=dst/.git config --add \
+ receive.fsck.badDate warn &&
+ git push --porcelain dst bogus >act 2>&1 &&
+ test_must_fail grep "missingEmail" act
+'
+
+test_expect_success \
+ 'receive.fsck.unterminatedHeader=warn triggers error' '
+ rm -rf dst &&
+ git init dst &&
+ git --git-dir=dst/.git config receive.fsckobjects true &&
+ git --git-dir=dst/.git config \
+ receive.fsck.unterminatedheader warn &&
+ test_must_fail git push --porcelain dst HEAD >act 2>&1 &&
+ grep "Cannot demote unterminatedheader" act
+'
+
test_done