Catch errors when writing an index that contains invalid objects.
[git/repo.git] / t / t3700-add.sh
blobc20e4c29fcc864dff80e5ae73a8ad7ede1f794f0
1 #!/bin/sh
3 # Copyright (c) 2006 Carl D. Worth
6 test_description='Test of git-add, including the -- option.'
8 . ./test-lib.sh
10 test_expect_success \
11 'Test of git-add' \
12 'touch foo && git-add foo'
14 test_expect_success \
15 'Post-check that foo is in the index' \
16 'git-ls-files foo | grep foo'
18 test_expect_success \
19 'Test that "git-add -- -q" works' \
20 'touch -- -q && git-add -- -q'
22 test_expect_success \
23 'git-add: Test that executable bit is not used if core.filemode=0' \
24 'git repo-config core.filemode 0 &&
25 echo foo >xfoo1 &&
26 chmod 755 xfoo1 &&
27 git-add xfoo1 &&
28 case "`git-ls-files --stage xfoo1`" in
29 100644" "*xfoo1) echo ok;;
30 *) echo fail; git-ls-files --stage xfoo1; exit 1;;
31 esac'
33 test_expect_success \
34 'git-update-index --add: Test that executable bit is not used...' \
35 'git repo-config core.filemode 0 &&
36 echo foo >xfoo2 &&
37 chmod 755 xfoo2 &&
38 git-update-index --add xfoo2 &&
39 case "`git-ls-files --stage xfoo2`" in
40 100644" "*xfoo2) echo ok;;
41 *) echo fail; git-ls-files --stage xfoo2; exit 1;;
42 esac'
44 test_done