]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5100-delta-pull.sh
[PATCH] git-ssh-pull: commit-id consistency
[thirdparty/git.git] / t / t5100-delta-pull.sh
CommitLineData
a48e1d67
JH
1#!/bin/sh
2#
3# Copyright (c) 2005 Junio C Hamano
4#
5
6test_description='Test pulling deltified objects
7
8'
9. ./test-lib.sh
10
11locate_obj='s|\(..\)|.git/objects/\1/|'
12
13test_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/'\''` &&
19
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'
35
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.
38
39test_expect_success \
40 'setup and cd into new repo' \
41 'mkdir dest && cd dest && rm -fr .git && git-init-db'
42
43test_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'
49
50test_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'
56
57test_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'
63
64test_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'
70
71test_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'
77
78test_done
79