]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1100-commit-tree-options.sh
Merge branch 'wb/fsmonitor-bitmap-fix'
[thirdparty/git.git] / t / t1100-commit-tree-options.sh
CommitLineData
c504aae2
RS
1#!/bin/sh
2#
3# Copyright (C) 2005 Rene Scharfe
4#
5
5be60078 6test_description='git commit-tree options test
c504aae2 7
5be60078 8This test checks that git commit-tree can create a specific commit
c504aae2 9object by defining all environment variables that it understands.
9aab1b51
JH
10
11Also make sure that command line parser understands the normal
12"flags first and then non flag arguments" command line.
c504aae2
RS
13'
14
15. ./test-lib.sh
16
17cat >expected <<EOF
f9e7d9f8 18tree $EMPTY_TREE
c504aae2
RS
19author Author Name <author@email> 1117148400 +0000
20committer Committer Name <committer@email> 1117150200 +0000
21
22comment text
23EOF
24
25test_expect_success \
26 'test preparation: write empty tree' \
5be60078 27 'git write-tree >treeid'
c504aae2
RS
28
29test_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" \
cbda02fc 38 TZ=GMT git commit-tree $(cat treeid) >commitid 2>/dev/null'
c504aae2
RS
39
40test_expect_success \
41 'read commit' \
cbda02fc 42 'git cat-file commit $(cat commitid) >commit'
c504aae2
RS
43
44test_expect_success \
45 'compare commit' \
188c3827 46 'test_cmp expected commit'
c504aae2 47
9aab1b51
JH
48
49test_expect_success 'flags and then non flags' '
425b8a22 50 test_tick &&
9aab1b51
JH
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
61'
62
c504aae2 63test_done