3 # Copyright (c) 2005 Johannes Schindelin
6 test_description
='Test git-rev-parse with different parent options'
10 echo "Hello World" > hello
11 echo "Silly example" > example
13 git-update-index
--add hello example
15 test_expect_success
'blob' "test blob = \"$(git-cat-file -t 557db03)\""
17 test_expect_success
'blob 557db03' "test \"Hello World\" = \"$(git-cat-file blob 557db03)\""
19 echo "It's a new day for git" >>hello
20 cat > diff.expect
<< EOF
21 diff --git a/hello b/hello
22 index 557db03..263414f 100644
27 +It's a new day for git
29 git-diff-files
-p > diff.output
30 test_expect_success
'git-diff-files -p' 'cmp diff.expect diff.output'
31 git
diff > diff.output
32 test_expect_success
'git diff' 'cmp diff.expect diff.output'
34 tree
=$
(git-write-tree
2>/dev
/null
)
36 test_expect_success
'tree' "test 8988da15d077d4829fc51d8544c097def6644dbb = $tree"
38 output
="$(echo "Initial commit
" | git-commit-tree $(git-write-tree) 2>&1 > .git/refs/heads/master)"
40 test_expect_success
'commit' "test 'Committing initial tree 8988da15d077d4829fc51d8544c097def6644dbb' = \"$output\""
42 git-diff-index
-p HEAD
> diff.output
43 test_expect_success
'git-diff-index -p HEAD' 'cmp diff.expect diff.output'
45 git
diff HEAD
> diff.output
46 test_expect_success
'git diff HEAD' 'cmp diff.expect diff.output'
49 #test_expect_success 'git-read-tree --reset HEAD' "git-read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git-update-index --refresh)\""
51 cat > whatchanged.expect
<< EOF
52 diff-tree VARIABLE (from root)
58 diff --git a/example b/example
60 index 0000000..f24c74a
65 diff --git a/hello b/hello
67 index 0000000..557db03
74 git-whatchanged
-p --root | \
75 sed -e "1s/^\(.\{10\}\).\{40\}/\1VARIABLE/" \
76 -e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \
78 test_expect_success
'git-whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output'
81 test_expect_success
'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag'
83 # TODO: test git-clone
85 git checkout
-b mybranch
86 test_expect_success
'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch'
88 cat > branch.expect
<<EOF
93 git branch
> branch.output
94 test_expect_success
'git branch' 'cmp branch.expect branch.output'
97 echo "Work, work, work" >>hello
98 git commit
-m 'Some work.' hello
102 echo "Play, play, play" >>hello
103 echo "Lots of fun" >>example
104 git commit
-m 'Some fun.' hello example
106 test_expect_failure
'git resolve now fails' 'git resolve HEAD mybranch "Merge work in mybranch"'
110 It's a new day for git
115 git commit
-m 'Merged "mybranch" changes.' hello
117 cat > show-branch.expect
<< EOF
118 * [master] Merged "mybranch" changes.
119 ! [mybranch] Some work.
121 + [master] Merged "mybranch" changes.
122 ++ [mybranch] Some work.
125 git show-branch
--topo-order master mybranch
> show-branch.output
126 test_expect_success
'git show-branch' 'cmp show-branch.expect show-branch.output'
128 git checkout mybranch
130 cat > resolve.expect
<< EOF
131 Updating from VARIABLE to VARIABLE.
134 2 files changed, 2 insertions(+), 0 deletions(-)
137 git resolve HEAD master
"Merge upstream changes." | \
138 sed -e "1s/[0-9a-f]\{40\}/VARIABLE/g" > resolve.output
139 test_expect_success
'git resolve' 'cmp resolve.expect resolve.output'
141 cat > show-branch2.expect
<< EOF
142 ! [master] Merged "mybranch" changes.
143 * [mybranch] Merged "mybranch" changes.
145 ++ [master] Merged "mybranch" changes.
148 git show-branch
--topo-order master mybranch
> show-branch2.output
149 test_expect_success
'git show-branch' 'cmp show-branch2.expect show-branch2.output'
151 # TODO: test git fetch
153 # TODO: test git push
155 test_expect_success
'git repack' 'git repack'
156 test_expect_success
'git prune-packed' 'git prune-packed'
157 test_expect_failure
'-> only packed objects' 'find -type f .git/objects/[0-9a-f][0-9a-f]'