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