Merge branch 'cd/bisect-messages-from-pre-flight-states'
[git/debian.git] / t / t1100-commit-tree-options.sh
blob0f37a43fd3c5b2638fe41408a3860ce2facd6401
1 #!/bin/sh
3 # Copyright (C) 2005 Rene Scharfe
6 test_description='git commit-tree options test
8 This test checks that git commit-tree can create a specific commit
9 object by defining all environment variables that it understands.
11 Also make sure that command line parser understands the normal
12 "flags first and then non flag arguments" command line.
15 TEST_PASSES_SANITIZE_LEAK=true
16 . ./test-lib.sh
18 cat >expected <<EOF
19 tree $EMPTY_TREE
20 author Author Name <author@email> 1117148400 +0000
21 committer Committer Name <committer@email> 1117150200 +0000
23 comment text
24 EOF
26 test_expect_success \
27 'test preparation: write empty tree' \
28 'git write-tree >treeid'
30 test_expect_success \
31 'construct commit' \
32 'echo comment text |
33 GIT_AUTHOR_NAME="Author Name" \
34 GIT_AUTHOR_EMAIL="author@email" \
35 GIT_AUTHOR_DATE="2005-05-26 23:00" \
36 GIT_COMMITTER_NAME="Committer Name" \
37 GIT_COMMITTER_EMAIL="committer@email" \
38 GIT_COMMITTER_DATE="2005-05-26 23:30" \
39 TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null'
41 test_expect_success \
42 'read commit' \
43 'git cat-file commit $(cat commitid) >commit'
45 test_expect_success \
46 'compare commit' \
47 'test_cmp expected commit'
50 test_expect_success 'flags and then non flags' '
51 test_tick &&
52 echo comment text |
53 git commit-tree $(cat treeid) >commitid &&
54 echo comment text |
55 git commit-tree $(cat treeid) -p $(cat commitid) >childid-1 &&
56 echo comment text |
57 git commit-tree -p $(cat commitid) $(cat treeid) >childid-2 &&
58 test_cmp childid-1 childid-2 &&
59 git commit-tree $(cat treeid) -m foo >childid-3 &&
60 git commit-tree -m foo $(cat treeid) >childid-4 &&
61 test_cmp childid-3 childid-4
64 test_done