t / t0000-basic.shon commit push test: use test_config when appropriate (3c69552)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='Test the very basics part #1.
   7
   8The rest of the test suite does not check the basic operation of git
   9plumbing commands to work very carefully.  Their job is to concentrate
  10on tricky features that caused bugs in the past to detect regression.
  11
  12This test runs very basic features, like registering things in cache,
  13writing tree, etc.
  14
  15Note that this test *deliberately* hard-codes many expected object
  16IDs.  When object ID computation changes, like in the previous case of
  17swapping compression and hashing order, the person who is making the
  18modification *should* take notice and update the test vectors here.
  19'
  20
  21. ./test-lib.sh
  22
  23################################################################
  24# git init has been done in an empty repository.
  25# make sure it is empty.
  26
  27test_expect_success '.git/objects should be empty after git init in an empty repo' '
  28        find .git/objects -type f -print >should-be-empty &&
  29        test_line_count = 0 should-be-empty
  30'
  31
  32# also it should have 2 subdirectories; no fan-out anymore, pack, and info.
  33# 3 is counting "objects" itself
  34test_expect_success '.git/objects should have 3 subdirectories' '
  35        find .git/objects -type d -print >full-of-directories &&
  36        test_line_count = 3 full-of-directories
  37'
  38
  39################################################################
  40# Test harness
  41test_expect_success 'success is reported like this' '
  42        :
  43'
  44test_expect_failure 'pretend we have a known breakage' '
  45        false
  46'
  47
  48run_sub_test_lib_test () {
  49        name="$1" descr="$2" # stdin is the body of the test code
  50        mkdir "$name" &&
  51        (
  52                cd "$name" &&
  53                cat >"$name.sh" <<-EOF &&
  54                #!$SHELL_PATH
  55
  56                test_description='$descr (run in sub test-lib)
  57
  58                This is run in a sub test-lib so that we do not get incorrect
  59                passing metrics
  60                '
  61
  62                # Point to the t/test-lib.sh, which isn't in ../ as usual
  63                . "\$TEST_DIRECTORY"/test-lib.sh
  64                EOF
  65                cat >>"$name.sh" &&
  66                chmod +x "$name.sh" &&
  67                export TEST_DIRECTORY &&
  68                ./"$name.sh" >out 2>err
  69        )
  70}
  71
  72check_sub_test_lib_test () {
  73        name="$1" # stdin is the expected output from the test
  74        (
  75                cd "$name" &&
  76                ! test -s err &&
  77                sed -e 's/^> //' -e 's/Z$//' >expect &&
  78                test_cmp expect out
  79        )
  80}
  81
  82test_expect_success 'pretend we have a fully passing test suite' "
  83        run_sub_test_lib_test full-pass '3 passing tests' <<-\\EOF &&
  84        for i in 1 2 3
  85        do
  86                test_expect_success \"passing test #\$i\" 'true'
  87        done
  88        test_done
  89        EOF
  90        check_sub_test_lib_test full-pass <<-\\EOF
  91        > ok 1 - passing test #1
  92        > ok 2 - passing test #2
  93        > ok 3 - passing test #3
  94        > # passed all 3 test(s)
  95        > 1..3
  96        EOF
  97"
  98
  99test_expect_success 'pretend we have a partially passing test suite' "
 100        test_must_fail run_sub_test_lib_test \
 101                partial-pass '2/3 tests passing' <<-\\EOF &&
 102        test_expect_success 'passing test #1' 'true'
 103        test_expect_success 'failing test #2' 'false'
 104        test_expect_success 'passing test #3' 'true'
 105        test_done
 106        EOF
 107        check_sub_test_lib_test partial-pass <<-\\EOF
 108        > ok 1 - passing test #1
 109        > not ok 2 - failing test #2
 110        #       false
 111        > ok 3 - passing test #3
 112        > # failed 1 among 3 test(s)
 113        > 1..3
 114        EOF
 115"
 116
 117test_expect_success 'pretend we have a known breakage' "
 118        run_sub_test_lib_test failing-todo 'A failing TODO test' <<-\\EOF &&
 119        test_expect_success 'passing test' 'true'
 120        test_expect_failure 'pretend we have a known breakage' 'false'
 121        test_done
 122        EOF
 123        check_sub_test_lib_test failing-todo <<-\\EOF
 124        > ok 1 - passing test
 125        > not ok 2 - pretend we have a known breakage # TODO known breakage
 126        > # still have 1 known breakage(s)
 127        > # passed all remaining 1 test(s)
 128        > 1..2
 129        EOF
 130"
 131
 132test_expect_success 'pretend we have fixed a known breakage' "
 133        run_sub_test_lib_test passing-todo 'A passing TODO test' <<-\\EOF &&
 134        test_expect_failure 'pretend we have fixed a known breakage' 'true'
 135        test_done
 136        EOF
 137        check_sub_test_lib_test passing-todo <<-\\EOF
 138        > ok 1 - pretend we have fixed a known breakage # TODO known breakage vanished
 139        > # 1 known breakage(s) vanished; please update test(s)
 140        > 1..1
 141        EOF
 142"
 143
 144test_expect_success 'pretend we have fixed one of two known breakages (run in sub test-lib)' "
 145        run_sub_test_lib_test partially-passing-todos \
 146                '2 TODO tests, one passing' <<-\\EOF &&
 147        test_expect_failure 'pretend we have a known breakage' 'false'
 148        test_expect_success 'pretend we have a passing test' 'true'
 149        test_expect_failure 'pretend we have fixed another known breakage' 'true'
 150        test_done
 151        EOF
 152        check_sub_test_lib_test partially-passing-todos <<-\\EOF
 153        > not ok 1 - pretend we have a known breakage # TODO known breakage
 154        > ok 2 - pretend we have a passing test
 155        > ok 3 - pretend we have fixed another known breakage # TODO known breakage vanished
 156        > # 1 known breakage(s) vanished; please update test(s)
 157        > # still have 1 known breakage(s)
 158        > # passed all remaining 1 test(s)
 159        > 1..3
 160        EOF
 161"
 162
 163test_expect_success 'pretend we have a pass, fail, and known breakage' "
 164        test_must_fail run_sub_test_lib_test \
 165                mixed-results1 'mixed results #1' <<-\\EOF &&
 166        test_expect_success 'passing test' 'true'
 167        test_expect_success 'failing test' 'false'
 168        test_expect_failure 'pretend we have a known breakage' 'false'
 169        test_done
 170        EOF
 171        check_sub_test_lib_test mixed-results1 <<-\\EOF
 172        > ok 1 - passing test
 173        > not ok 2 - failing test
 174        > #     false
 175        > not ok 3 - pretend we have a known breakage # TODO known breakage
 176        > # still have 1 known breakage(s)
 177        > # failed 1 among remaining 2 test(s)
 178        > 1..3
 179        EOF
 180"
 181
 182test_expect_success 'pretend we have a mix of all possible results' "
 183        test_must_fail run_sub_test_lib_test \
 184                mixed-results2 'mixed results #2' <<-\\EOF &&
 185        test_expect_success 'passing test' 'true'
 186        test_expect_success 'passing test' 'true'
 187        test_expect_success 'passing test' 'true'
 188        test_expect_success 'passing test' 'true'
 189        test_expect_success 'failing test' 'false'
 190        test_expect_success 'failing test' 'false'
 191        test_expect_success 'failing test' 'false'
 192        test_expect_failure 'pretend we have a known breakage' 'false'
 193        test_expect_failure 'pretend we have a known breakage' 'false'
 194        test_expect_failure 'pretend we have fixed a known breakage' 'true'
 195        test_done
 196        EOF
 197        check_sub_test_lib_test mixed-results2 <<-\\EOF
 198        > ok 1 - passing test
 199        > ok 2 - passing test
 200        > ok 3 - passing test
 201        > ok 4 - passing test
 202        > not ok 5 - failing test
 203        > #     false
 204        > not ok 6 - failing test
 205        > #     false
 206        > not ok 7 - failing test
 207        > #     false
 208        > not ok 8 - pretend we have a known breakage # TODO known breakage
 209        > not ok 9 - pretend we have a known breakage # TODO known breakage
 210        > ok 10 - pretend we have fixed a known breakage # TODO known breakage vanished
 211        > # 1 known breakage(s) vanished; please update test(s)
 212        > # still have 2 known breakage(s)
 213        > # failed 3 among remaining 7 test(s)
 214        > 1..10
 215        EOF
 216"
 217
 218test_set_prereq HAVEIT
 219haveit=no
 220test_expect_success HAVEIT 'test runs if prerequisite is satisfied' '
 221        test_have_prereq HAVEIT &&
 222        haveit=yes
 223'
 224donthaveit=yes
 225test_expect_success DONTHAVEIT 'unmet prerequisite causes test to be skipped' '
 226        donthaveit=no
 227'
 228if test $haveit$donthaveit != yesyes
 229then
 230        say "bug in test framework: prerequisite tags do not work reliably"
 231        exit 1
 232fi
 233
 234test_set_prereq HAVETHIS
 235haveit=no
 236test_expect_success HAVETHIS,HAVEIT 'test runs if prerequisites are satisfied' '
 237        test_have_prereq HAVEIT &&
 238        test_have_prereq HAVETHIS &&
 239        haveit=yes
 240'
 241donthaveit=yes
 242test_expect_success HAVEIT,DONTHAVEIT 'unmet prerequisites causes test to be skipped' '
 243        donthaveit=no
 244'
 245donthaveiteither=yes
 246test_expect_success DONTHAVEIT,HAVEIT 'unmet prerequisites causes test to be skipped' '
 247        donthaveiteither=no
 248'
 249if test $haveit$donthaveit$donthaveiteither != yesyesyes
 250then
 251        say "bug in test framework: multiple prerequisite tags do not work reliably"
 252        exit 1
 253fi
 254
 255test_lazy_prereq LAZY_TRUE true
 256havetrue=no
 257test_expect_success LAZY_TRUE 'test runs if lazy prereq is satisfied' '
 258        havetrue=yes
 259'
 260donthavetrue=yes
 261test_expect_success !LAZY_TRUE 'missing lazy prereqs skip tests' '
 262        donthavetrue=no
 263'
 264
 265if test "$havetrue$donthavetrue" != yesyes
 266then
 267        say 'bug in test framework: lazy prerequisites do not work'
 268        exit 1
 269fi
 270
 271test_lazy_prereq LAZY_FALSE false
 272nothavefalse=no
 273test_expect_success !LAZY_FALSE 'negative lazy prereqs checked' '
 274        nothavefalse=yes
 275'
 276havefalse=yes
 277test_expect_success LAZY_FALSE 'missing negative lazy prereqs will skip' '
 278        havefalse=no
 279'
 280
 281if test "$nothavefalse$havefalse" != yesyes
 282then
 283        say 'bug in test framework: negative lazy prerequisites do not work'
 284        exit 1
 285fi
 286
 287clean=no
 288test_expect_success 'tests clean up after themselves' '
 289        test_when_finished clean=yes
 290'
 291
 292if test $clean != yes
 293then
 294        say "bug in test framework: basic cleanup command does not work reliably"
 295        exit 1
 296fi
 297
 298test_expect_success 'tests clean up even on failures' "
 299        test_must_fail run_sub_test_lib_test \
 300                failing-cleanup 'Failing tests with cleanup commands' <<-\\EOF &&
 301        test_expect_success 'tests clean up even after a failure' '
 302                touch clean-after-failure &&
 303                test_when_finished rm clean-after-failure &&
 304                (exit 1)
 305        '
 306        test_expect_success 'failure to clean up causes the test to fail' '
 307                test_when_finished \"(exit 2)\"
 308        '
 309        test_done
 310        EOF
 311        check_sub_test_lib_test failing-cleanup <<-\\EOF
 312        > not ok 1 - tests clean up even after a failure
 313        > #     Z
 314        > #     touch clean-after-failure &&
 315        > #     test_when_finished rm clean-after-failure &&
 316        > #     (exit 1)
 317        > #     Z
 318        > not ok 2 - failure to clean up causes the test to fail
 319        > #     Z
 320        > #     test_when_finished \"(exit 2)\"
 321        > #     Z
 322        > # failed 2 among 2 test(s)
 323        > 1..2
 324        EOF
 325"
 326
 327################################################################
 328# Basics of the basics
 329
 330# updating a new file without --add should fail.
 331test_expect_success 'git update-index without --add should fail adding' '
 332        test_must_fail git update-index should-be-empty
 333'
 334
 335# and with --add it should succeed, even if it is empty (it used to fail).
 336test_expect_success 'git update-index with --add should succeed' '
 337        git update-index --add should-be-empty
 338'
 339
 340test_expect_success 'writing tree out with git write-tree' '
 341        tree=$(git write-tree)
 342'
 343
 344# we know the shape and contents of the tree and know the object ID for it.
 345test_expect_success 'validate object ID of a known tree' '
 346        test "$tree" = 7bb943559a305bdd6bdee2cef6e5df2413c3d30a
 347    '
 348
 349# Removing paths.
 350test_expect_success 'git update-index without --remove should fail removing' '
 351        rm -f should-be-empty full-of-directories &&
 352        test_must_fail git update-index should-be-empty
 353'
 354
 355test_expect_success 'git update-index with --remove should be able to remove' '
 356        git update-index --remove should-be-empty
 357'
 358
 359# Empty tree can be written with recent write-tree.
 360test_expect_success 'git write-tree should be able to write an empty tree' '
 361        tree=$(git write-tree)
 362'
 363
 364test_expect_success 'validate object ID of a known tree' '
 365        test "$tree" = 4b825dc642cb6eb9a060e54bf8d69288fbee4904
 366'
 367
 368# Various types of objects
 369
 370# Some filesystems do not support symblic links; on such systems
 371# some expected values are different
 372if test_have_prereq SYMLINKS
 373then
 374        expectfilter=cat
 375        expectedtree=087704a96baf1c2d1c869a8b084481e121c88b5b
 376        expectedptree1=21ae8269cacbe57ae09138dcc3a2887f904d02b3
 377        expectedptree2=3c5e5399f3a333eddecce7a9b9465b63f65f51e2
 378else
 379        expectfilter='grep -v sym'
 380        expectedtree=8e18edf7d7edcf4371a3ac6ae5f07c2641db7c46
 381        expectedptree1=cfb8591b2f65de8b8cc1020cd7d9e67e7793b325
 382        expectedptree2=ce580448f0148b985a513b693fdf7d802cacb44f
 383fi
 384
 385
 386test_expect_success 'adding various types of objects with git update-index --add' '
 387        mkdir path2 path3 path3/subp3 &&
 388        paths="path0 path2/file2 path3/file3 path3/subp3/file3" &&
 389        (
 390                for p in $paths
 391                do
 392                        echo "hello $p" >$p || exit 1
 393                        if test_have_prereq SYMLINKS
 394                        then
 395                                ln -s "hello $p" ${p}sym || exit 1
 396                        fi
 397                done
 398        ) &&
 399        find path* ! -type d -print | xargs git update-index --add
 400'
 401
 402# Show them and see that matches what we expect.
 403test_expect_success 'showing stage with git ls-files --stage' '
 404        git ls-files --stage >current
 405'
 406
 407test_expect_success 'validate git ls-files output for a known tree' '
 408        $expectfilter >expected <<-\EOF &&
 409        100644 f87290f8eb2cbbea7857214459a0739927eab154 0       path0
 410        120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0       path0sym
 411        100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0       path2/file2
 412        120000 d8ce161addc5173867a3c3c730924388daedbc38 0       path2/file2sym
 413        100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0       path3/file3
 414        120000 8599103969b43aff7e430efea79ca4636466794f 0       path3/file3sym
 415        100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0       path3/subp3/file3
 416        120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0       path3/subp3/file3sym
 417        EOF
 418        test_cmp expected current
 419'
 420
 421test_expect_success 'writing tree out with git write-tree' '
 422        tree=$(git write-tree)
 423'
 424
 425test_expect_success 'validate object ID for a known tree' '
 426        test "$tree" = "$expectedtree"
 427'
 428
 429test_expect_success 'showing tree with git ls-tree' '
 430    git ls-tree $tree >current
 431'
 432
 433test_expect_success SYMLINKS 'git ls-tree output for a known tree' '
 434        cat >expected <<-\EOF &&
 435        100644 blob f87290f8eb2cbbea7857214459a0739927eab154    path0
 436        120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01    path0sym
 437        040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe    path2
 438        040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3    path3
 439        EOF
 440        test_cmp expected current
 441'
 442
 443# This changed in ls-tree pathspec change -- recursive does
 444# not show tree nodes anymore.
 445test_expect_success 'showing tree with git ls-tree -r' '
 446        git ls-tree -r $tree >current
 447'
 448
 449test_expect_success 'git ls-tree -r output for a known tree' '
 450        $expectfilter >expected <<-\EOF &&
 451        100644 blob f87290f8eb2cbbea7857214459a0739927eab154    path0
 452        120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01    path0sym
 453        100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7    path2/file2
 454        120000 blob d8ce161addc5173867a3c3c730924388daedbc38    path2/file2sym
 455        100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376    path3/file3
 456        120000 blob 8599103969b43aff7e430efea79ca4636466794f    path3/file3sym
 457        100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f    path3/subp3/file3
 458        120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c    path3/subp3/file3sym
 459        EOF
 460        test_cmp expected current
 461'
 462
 463# But with -r -t we can have both.
 464test_expect_success 'showing tree with git ls-tree -r -t' '
 465        git ls-tree -r -t $tree >current
 466'
 467
 468test_expect_success SYMLINKS 'git ls-tree -r output for a known tree' '
 469        cat >expected <<-\EOF &&
 470        100644 blob f87290f8eb2cbbea7857214459a0739927eab154    path0
 471        120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01    path0sym
 472        040000 tree 58a09c23e2ca152193f2786e06986b7b6712bdbe    path2
 473        100644 blob 3feff949ed00a62d9f7af97c15cd8a30595e7ac7    path2/file2
 474        120000 blob d8ce161addc5173867a3c3c730924388daedbc38    path2/file2sym
 475        040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3    path3
 476        100644 blob 0aa34cae68d0878578ad119c86ca2b5ed5b28376    path3/file3
 477        120000 blob 8599103969b43aff7e430efea79ca4636466794f    path3/file3sym
 478        040000 tree 3c5e5399f3a333eddecce7a9b9465b63f65f51e2    path3/subp3
 479        100644 blob 00fb5908cb97c2564a9783c0c64087333b3b464f    path3/subp3/file3
 480        120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c    path3/subp3/file3sym
 481        EOF
 482        test_cmp expected current
 483'
 484
 485test_expect_success 'writing partial tree out with git write-tree --prefix' '
 486        ptree=$(git write-tree --prefix=path3)
 487'
 488
 489test_expect_success 'validate object ID for a known tree' '
 490        test "$ptree" = "$expectedptree1"
 491'
 492
 493test_expect_success 'writing partial tree out with git write-tree --prefix' '
 494        ptree=$(git write-tree --prefix=path3/subp3)
 495'
 496
 497test_expect_success 'validate object ID for a known tree' '
 498        test "$ptree" = "$expectedptree2"
 499'
 500
 501test_expect_success 'put invalid objects into the index' '
 502        rm -f .git/index &&
 503        cat >badobjects <<-\EOF &&
 504        100644 blob 1000000000000000000000000000000000000000    dir/file1
 505        100644 blob 2000000000000000000000000000000000000000    dir/file2
 506        100644 blob 3000000000000000000000000000000000000000    dir/file3
 507        100644 blob 4000000000000000000000000000000000000000    dir/file4
 508        100644 blob 5000000000000000000000000000000000000000    dir/file5
 509        EOF
 510        git update-index --index-info <badobjects
 511'
 512
 513test_expect_success 'writing this tree without --missing-ok' '
 514        test_must_fail git write-tree
 515'
 516
 517test_expect_success 'writing this tree with --missing-ok' '
 518        git write-tree --missing-ok
 519'
 520
 521
 522################################################################
 523test_expect_success 'git read-tree followed by write-tree should be idempotent' '
 524        rm -f .git/index
 525        git read-tree $tree &&
 526        test -f .git/index &&
 527        newtree=$(git write-tree) &&
 528        test "$newtree" = "$tree"
 529'
 530
 531test_expect_success 'validate git diff-files output for a know cache/work tree state' '
 532        $expectfilter >expected <<\EOF &&
 533:100644 100644 f87290f8eb2cbbea7857214459a0739927eab154 0000000000000000000000000000000000000000 M      path0
 534:120000 120000 15a98433ae33114b085f3eb3bb03b832b3180a01 0000000000000000000000000000000000000000 M      path0sym
 535:100644 100644 3feff949ed00a62d9f7af97c15cd8a30595e7ac7 0000000000000000000000000000000000000000 M      path2/file2
 536:120000 120000 d8ce161addc5173867a3c3c730924388daedbc38 0000000000000000000000000000000000000000 M      path2/file2sym
 537:100644 100644 0aa34cae68d0878578ad119c86ca2b5ed5b28376 0000000000000000000000000000000000000000 M      path3/file3
 538:120000 120000 8599103969b43aff7e430efea79ca4636466794f 0000000000000000000000000000000000000000 M      path3/file3sym
 539:100644 100644 00fb5908cb97c2564a9783c0c64087333b3b464f 0000000000000000000000000000000000000000 M      path3/subp3/file3
 540:120000 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0000000000000000000000000000000000000000 M      path3/subp3/file3sym
 541EOF
 542        git diff-files >current &&
 543        test_cmp current expected
 544'
 545
 546test_expect_success 'git update-index --refresh should succeed' '
 547        git update-index --refresh
 548'
 549
 550test_expect_success 'no diff after checkout and git update-index --refresh' '
 551        git diff-files >current &&
 552        cmp -s current /dev/null
 553'
 554
 555################################################################
 556P=$expectedtree
 557
 558test_expect_success 'git commit-tree records the correct tree in a commit' '
 559        commit0=$(echo NO | git commit-tree $P) &&
 560        tree=$(git show --pretty=raw $commit0 |
 561                 sed -n -e "s/^tree //p" -e "/^author /q") &&
 562        test "z$tree" = "z$P"
 563'
 564
 565test_expect_success 'git commit-tree records the correct parent in a commit' '
 566        commit1=$(echo NO | git commit-tree $P -p $commit0) &&
 567        parent=$(git show --pretty=raw $commit1 |
 568                sed -n -e "s/^parent //p" -e "/^author /q") &&
 569        test "z$commit0" = "z$parent"
 570'
 571
 572test_expect_success 'git commit-tree omits duplicated parent in a commit' '
 573        commit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) &&
 574             parent=$(git show --pretty=raw $commit2 |
 575                sed -n -e "s/^parent //p" -e "/^author /q" |
 576                sort -u) &&
 577        test "z$commit0" = "z$parent" &&
 578        numparent=$(git show --pretty=raw $commit2 |
 579                sed -n -e "s/^parent //p" -e "/^author /q" |
 580                wc -l) &&
 581        test $numparent = 1
 582'
 583
 584test_expect_success 'update-index D/F conflict' '
 585        mv path0 tmp &&
 586        mv path2 path0 &&
 587        mv tmp path2 &&
 588        git update-index --add --replace path2 path0/file2 &&
 589        numpath0=$(git ls-files path0 | wc -l) &&
 590        test $numpath0 = 1
 591'
 592
 593test_expect_success 'very long name in the index handled sanely' '
 594
 595        a=a && # 1
 596        a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 16
 597        a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 256
 598        a=$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a$a && # 4096
 599        a=${a}q &&
 600
 601        >path4 &&
 602        git update-index --add path4 &&
 603        (
 604                git ls-files -s path4 |
 605                sed -e "s/      .*/     /" |
 606                tr -d "\012"
 607                echo "$a"
 608        ) | git update-index --index-info &&
 609        len=$(git ls-files "a*" | wc -c) &&
 610        test $len = 4098
 611'
 612
 613test_done