t0000-basic: more commit-tree tests.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Apr 26, 2006 at 18:25 UTC
9af0b8dbe2fb252262412a11254e2bcc6ffb87bb
1 file changed
+28
t/t0000-basic.sh
+28
@@ -226,4 +226,32 @@ test_expect_success \
226
'no diff after checkout and git-update-index --refresh.' \
227
'git-diff-files >current && cmp -s current /dev/null'
228
229
+################################################################
230
+P=087704a96baf1c2d1c869a8b084481e121c88b5b
231
+test_expect_success \
232
+ 'git-commit-tree records the correct tree in a commit.' \
233
+ 'commit0=$(echo NO | git-commit-tree $P) &&
234
+ tree=$(git show --pretty=raw $commit0 |
235
+ sed -n -e "s/^tree //p" -e "/^author /q") &&
236
+ test "z$tree" = "z$P"'
237
+
238
+test_expect_success \
239
+ 'git-commit-tree records the correct parent in a commit.' \
240
+ 'commit1=$(echo NO | git-commit-tree $P -p $commit0) &&
241
+ parent=$(git show --pretty=raw $commit1 |
242
+ sed -n -e "s/^parent //p" -e "/^author /q") &&
243
+ test "z$commit0" = "z$parent"'
244
+
245
+test_expect_success \
246
+ 'git-commit-tree omits duplicated parent in a commit.' \
247
+ 'commit2=$(echo NO | git-commit-tree $P -p $commit0 -p $commit0) &&
248
+ parent=$(git show --pretty=raw $commit2 |
249
+ sed -n -e "s/^parent //p" -e "/^author /q" |
250
+ sort -u) &&
251
+ test "z$commit0" = "z$parent" &&
252
+ numparent=$(git show --pretty=raw $commit2 |
253
+ sed -n -e "s/^parent //p" -e "/^author /q" |
254
+ wc -l) &&
255
+ test $numparent = 1'
256
+
257
test_done