blob: fc179ac5dd604a085c9a19a491f0abb7ac4c066f [file] [log] [blame]
Alexandre Julliarddb137fe2009-08-17 17:35:44 +02001#!/bin/sh
2
3test_description='test read-tree into a fresh index file'
4
Johannes Schindelin06d53142020-11-18 23:44:21 +00005GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
Johannes Schindelin334afbc2020-11-18 23:44:19 +00006export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
Ævar Arnfjörð Bjarmason98300c82021-10-12 15:56:43 +02008TEST_PASSES_SANITIZE_LEAK=true
Alexandre Julliarddb137fe2009-08-17 17:35:44 +02009. ./test-lib.sh
10
11test_expect_success setup '
12 echo one >a &&
13 git add a &&
14 git commit -m initial
15'
16
17test_expect_success 'non-existent index file' '
18 rm -f new-index &&
Johannes Schindelin06d53142020-11-18 23:44:21 +000019 GIT_INDEX_FILE=new-index git read-tree main
Alexandre Julliarddb137fe2009-08-17 17:35:44 +020020'
21
22test_expect_success 'empty index file' '
23 rm -f new-index &&
24 > new-index &&
Johannes Schindelin06d53142020-11-18 23:44:21 +000025 GIT_INDEX_FILE=new-index git read-tree main
Alexandre Julliarddb137fe2009-08-17 17:35:44 +020026'
27
28test_done
29