t / t4044-diff-index-unique-abbrev.shon commit Merge branches 'bp/reset-quiet' and 'js/mingw-http-ssl' into nd/config-split (89e4fcb)
   1#!/bin/sh
   2
   3test_description='test unique sha1 abbreviation on "index from..to" line'
   4. ./test-lib.sh
   5
   6if ! test_have_prereq SHA1
   7then
   8       skip_all='not using SHA-1 for objects'
   9       test_done
  10fi
  11
  12cat >expect_initial <<EOF
  13100644 blob 51d2738463ea4ca66f8691c91e33ce64b7d41bb1    foo
  14EOF
  15
  16cat >expect_update <<EOF
  17100644 blob 51d2738efb4ad8a1e40bed839ab8e116f0a15e47    foo
  18EOF
  19
  20test_expect_success 'setup' '
  21        echo 4827 > foo &&
  22        git add foo &&
  23        git commit -m "initial" &&
  24        git cat-file -p HEAD: > actual &&
  25        test_cmp expect_initial actual &&
  26        echo 11742 > foo &&
  27        git commit -a -m "update" &&
  28        git cat-file -p HEAD: > actual &&
  29        test_cmp expect_update actual
  30'
  31
  32cat >expect <<EOF
  33index 51d27384..51d2738e 100644
  34EOF
  35
  36test_expect_success 'diff does not produce ambiguous index line' '
  37        git diff HEAD^..HEAD | grep index > actual &&
  38        test_cmp expect actual
  39'
  40
  41test_done