[PATCH] read-tree --emu23.
[git/dscho.git] / t / t5100-delta-pull.sh
blob8693c5ce89a9e184521cf70a9fc3fdd68984ddc7
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='Test pulling deltified objects
9 . ./test-lib.sh
11 locate_obj='s|\(..\)|.git/objects/\1/|'
13 test_expect_success \
14 setup \
15 'cat ../README >a &&
16 git-update-cache --add a &&
17 a0=`git-ls-files --stage |
18 sed -e '\''s/^[0-7]* \([0-9a-f]*\) .*/\1/'\''` &&
20 sed -e 's/test/TEST/g' ../README >a &&
21 git-update-cache a &&
22 a1=`git-ls-files --stage |
23 sed -e '\''s/^[0-7]* \([0-9a-f]*\) .*/\1/'\''` &&
24 tree=`git-write-tree` &&
25 commit=`git-commit-tree $tree </dev/null` &&
26 a0f=`echo "$a0" | sed -e "$locate_obj"` &&
27 a1f=`echo "$a1" | sed -e "$locate_obj"` &&
28 echo commit $commit &&
29 echo a0 $a0 &&
30 echo a1 $a1 &&
31 ls -l $a0f $a1f &&
32 echo $commit >.git/HEAD &&
33 git-mkdelta -v $a0 $a1 &&
34 ls -l $a0f $a1f'
36 # Now commit has a tree that records delitified "a" whose SHA1 is a1.
37 # Create a new repo and pull this commit into it.
39 test_expect_success \
40 'setup and cd into new repo' \
41 'mkdir dest && cd dest && rm -fr .git && git-init-db'
43 test_expect_success \
44 'pull from deltified repo into a new repo without -d' \
45 'rm -fr .git a && git-init-db &&
46 git-local-pull -v -a $commit ../.git/ &&
47 git-cat-file blob $a1 >a &&
48 diff -u a ../a'
50 test_expect_failure \
51 'pull from deltified repo into a new repo with -d' \
52 'rm -fr .git a && git-init-db &&
53 git-local-pull -v -a -d $commit ../.git/ &&
54 git-cat-file blob $a1 >a &&
55 diff -u a ../a'
57 test_expect_failure \
58 'pull from deltified repo after delta failure without --recover' \
59 'rm -f a &&
60 git-local-pull -v -a $commit ../.git/ &&
61 git-cat-file blob $a1 >a &&
62 diff -u a ../a'
64 test_expect_success \
65 'pull from deltified repo after delta failure with --recover' \
66 'rm -f a &&
67 git-local-pull -v -a --recover $commit ../.git/ &&
68 git-cat-file blob $a1 >a &&
69 diff -u a ../a'
71 test_expect_success \
72 'missing-tree or missing-blob should be re-fetched without --recover' \
73 'rm -f a $a0f $a1f &&
74 git-local-pull -v -a $commit ../.git/ &&
75 git-cat-file blob $a1 >a &&
76 diff -u a ../a'
78 test_done