1#!/bin/sh
   2test_description='pack should notice missing commit objects'
   4. ./test-lib.sh
   6test_expect_success setup '
   8        for i in 1 2 3 4 5
   9        do
  10                echo "$i" >"file$i" &&
  11                git add "file$i" &&
  12                test_tick &&
  13                git commit -m "$i" &&
  14                git tag "tag$i"
  15        done &&
  16        obj=$(git rev-parse --verify tag3) &&
  17        fanout=$(expr "$obj" : "\(..\)") &&
  18        remainder=$(expr "$obj" : "..\(.*\)") &&
  19        rm -f ".git/objects/$fanout/$remainder"
  20'
  21test_expect_success 'check corruption' '
  23        test_must_fail git fsck
  24'
  25test_expect_success 'rev-list notices corruption (1)' '
  27        test_must_fail git rev-list HEAD
  28'
  29test_expect_success 'rev-list notices corruption (2)' '
  31        test_must_fail git rev-list --objects HEAD
  32'
  33test_expect_success 'pack-objects notices corruption' '
  35        echo HEAD |
  36        test_must_fail git pack-objects --revs pack
  37'
  38test_done