~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-updates

« back to all changes in this revision

Viewing changes to t/t4017-diff-retval.sh

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-04-22 13:31:05 UTC
  • mfrom: (1.1.14)
  • Revision ID: package-import@ubuntu.com-20070422133105-tkmhz328g2p0epz1
Tags: 1:1.5.1.2-1
* new upstream point release.
* debian/changelog.upstream: upstream changes taken from mailing list
  announcement.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
test_description='Return value of diffs'
 
4
 
 
5
. ./test-lib.sh
 
6
 
 
7
test_expect_success 'setup' '
 
8
        echo 1 >a &&
 
9
        git add . &&
 
10
        git commit -m first &&
 
11
        echo 2 >b &&
 
12
        git add . &&
 
13
        git commit -a -m second
 
14
'
 
15
 
 
16
test_expect_success 'git diff-tree HEAD^ HEAD' '
 
17
        git diff-tree --exit-code HEAD^ HEAD
 
18
        test $? = 1
 
19
'
 
20
test_expect_success 'git diff-tree HEAD^ HEAD -- a' '
 
21
        git diff-tree --exit-code HEAD^ HEAD -- a
 
22
        test $? = 0
 
23
'
 
24
test_expect_success 'git diff-tree HEAD^ HEAD -- b' '
 
25
        git diff-tree --exit-code HEAD^ HEAD -- b
 
26
        test $? = 1
 
27
'
 
28
test_expect_success 'echo HEAD | git diff-tree --stdin' '
 
29
        echo $(git rev-parse HEAD) | git diff-tree --exit-code --stdin
 
30
        test $? = 1
 
31
'
 
32
test_expect_success 'git diff-tree HEAD HEAD' '
 
33
        git diff-tree --exit-code HEAD HEAD
 
34
        test $? = 0
 
35
'
 
36
test_expect_success 'git diff-files' '
 
37
        git diff-files --exit-code
 
38
        test $? = 0
 
39
'
 
40
test_expect_success 'git diff-index --cached HEAD' '
 
41
        git diff-index --exit-code --cached HEAD
 
42
        test $? = 0
 
43
'
 
44
test_expect_success 'git diff-index --cached HEAD^' '
 
45
        git diff-index --exit-code --cached HEAD^
 
46
        test $? = 1
 
47
'
 
48
test_expect_success 'git diff-index --cached HEAD^' '
 
49
        echo text >>b &&
 
50
        echo 3 >c &&
 
51
        git add . && {
 
52
                git diff-index --exit-code --cached HEAD^
 
53
                test $? = 1
 
54
        }
 
55
'
 
56
test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' '
 
57
        git commit -m "text in b" && {
 
58
                git diff-tree -p --exit-code -Stext HEAD^ HEAD -- b
 
59
                test $? = 1
 
60
        }
 
61
'
 
62
test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' '
 
63
        git diff-tree -p --exit-code -Snot-found HEAD^ HEAD -- b
 
64
        test $? = 0
 
65
'
 
66
test_expect_success 'git diff-files' '
 
67
        echo 3 >>c && {
 
68
                git diff-files --exit-code
 
69
                test $? = 1
 
70
        }
 
71
'
 
72
test_expect_success 'git diff-index --cached HEAD' '
 
73
        git update-index c && {
 
74
                git diff-index --exit-code --cached HEAD
 
75
                test $? = 1
 
76
        }
 
77
'
 
78
 
 
79
test_done