Merge branch 'rs/fsck-nul-header'
[git/git-svn.git] / t / t1100-commit-tree-options.sh
blobf8457f9d14c90349b0d3b09a3f695cbfafc3cbbf
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-lib.sh
17 cat >expected <<EOF
18 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
19 author Author Name <author@email> 1117148400 +0000
20 committer Committer Name <committer@email> 1117150200 +0000
22 comment text
23 EOF
25 test_expect_success \
26 'test preparation: write empty tree' \
27 'git write-tree >treeid'
29 test_expect_success \
30 'construct commit' \
31 'echo comment text |
32 GIT_AUTHOR_NAME="Author Name" \
33 GIT_AUTHOR_EMAIL="author@email" \
34 GIT_AUTHOR_DATE="2005-05-26 23:00" \
35 GIT_COMMITTER_NAME="Committer Name" \
36 GIT_COMMITTER_EMAIL="committer@email" \
37 GIT_COMMITTER_DATE="2005-05-26 23:30" \
38 TZ=GMT git commit-tree `cat treeid` >commitid 2>/dev/null'
40 test_expect_success \
41 'read commit' \
42 'git cat-file commit `cat commitid` >commit'
44 test_expect_success \
45 'compare commit' \
46 'test_cmp expected commit'
49 test_expect_success 'flags and then non flags' '
50 test_tick &&
51 echo comment text |
52 git commit-tree $(cat treeid) >commitid &&
53 echo comment text |
54 git commit-tree $(cat treeid) -p $(cat commitid) >childid-1 &&
55 echo comment text |
56 git commit-tree -p $(cat commitid) $(cat treeid) >childid-2 &&
57 test_cmp childid-1 childid-2 &&
58 git commit-tree $(cat treeid) -m foo >childid-3 &&
59 git commit-tree -m foo $(cat treeid) >childid-4 &&
60 test_cmp childid-3 childid-4
63 test_done