Merge branch 'js/fsck-tag-validation'
authorJunio C Hamano <gitster@pobox.com>
Mon, 22 Dec 2014 20:27:41 +0000 (12:27 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Dec 2014 20:27:41 +0000 (12:27 -0800)
New tag object format validation added in 2.2 showed garbage
after a tagname it reported in its error message.

* js/fsck-tag-validation:
index-pack: terminate object buffers with NUL
fsck: properly bound "invalid tag name" error message

1  2 
builtin/index-pack.c
fsck.c
t/t1450-fsck.sh
Simple merge
diff --cc fsck.c
Simple merge
diff --cc t/t1450-fsck.sh
index d00b70f99deffc6a4009fcea2ef387aade68d3e6,7850607783cf6d59b893b93a641e4c00d96c56db..1f04b8aa3ff925f469ffa60ce47f9d5659b9acaa
@@@ -229,29 -209,14 +229,33 @@@ test_expect_success 'tag with incorrec
        echo $tag >.git/refs/tags/wrong &&
        test_when_finished "git update-ref -d refs/tags/wrong" &&
        git fsck --tags 2>out &&
-       grep "invalid .tag. name" out &&
-       grep "expected .tagger. line" out
+       cat >expect <<-EOF &&
+       warning in tag $tag: invalid '\''tag'\'' name: wrong name format
+       warning in tag $tag: invalid format - expected '\''tagger'\'' line
+       EOF
+       test_cmp expect out
  '
  
 +test_expect_success 'tag with bad tagger' '
 +      sha=$(git rev-parse HEAD) &&
 +      cat >wrong-tag <<-EOF &&
 +      object $sha
 +      type commit
 +      tag not-quite-wrong
 +      tagger Bad Tagger Name
 +
 +      This is an invalid tag.
 +      EOF
 +
 +      tag=$(git hash-object --literally -t tag -w --stdin <wrong-tag) &&
 +      test_when_finished "remove_object $tag" &&
 +      echo $tag >.git/refs/tags/wrong &&
 +      test_when_finished "git update-ref -d refs/tags/wrong" &&
 +      test_must_fail git fsck --tags 2>out &&
 +      grep "error in tag .*: invalid author/committer" out
 +'
 +
  test_expect_success 'cleaned up' '
        git fsck >actual 2>&1 &&
        test_cmp empty actual