~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-security

« back to all changes in this revision

Viewing changes to t/t5000-tar-tree.sh

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-10-04 08:27:01 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20071004082701-rsd058ontoqz4i30
Tags: 1:1.5.3.4-1
new upstream point release (closes: #445188).

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# Copyright (C) 2005 Rene Scharfe
4
4
#
5
5
 
6
 
test_description='git-tar-tree and git-get-tar-commit-id test
 
6
test_description='git tar-tree and git get-tar-commit-id test
7
7
 
8
8
This test covers the topics of file contents, commit date handling and
9
9
commit id embedding:
13
13
  binary file (/bin/sh).  Only paths shorter than 99 characters are
14
14
  used.
15
15
 
16
 
  git-tar-tree applies the commit date to every file in the archive it
 
16
  git tar-tree applies the commit date to every file in the archive it
17
17
  creates.  The test sets the commit date to a specific value and checks
18
18
  if the tar archive contains that value.
19
19
 
20
 
  When giving git-tar-tree a commit id (in contrast to a tree id) it
 
20
  When giving git tar-tree a commit id (in contrast to a tree id) it
21
21
  embeds this commit id into the tar archive as a comment.  The test
22
 
  checks the ability of git-get-tar-commit-id to figure it out from the
 
22
  checks the ability of git get-tar-commit-id to figure it out from the
23
23
  tar file.
24
24
 
25
25
'
42
42
 
43
43
test_expect_success \
44
44
    'add files to repository' \
45
 
    'find a -type f | xargs git-update-index --add &&
46
 
     find a -type l | xargs git-update-index --add &&
47
 
     treeid=`git-write-tree` &&
 
45
    'find a -type f | xargs git update-index --add &&
 
46
     find a -type l | xargs git update-index --add &&
 
47
     treeid=`git write-tree` &&
48
48
     echo $treeid >treeid &&
49
 
     git-update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
50
 
     git-commit-tree $treeid </dev/null)'
51
 
 
52
 
test_expect_success \
53
 
    'git-archive' \
54
 
    'git-archive HEAD >b.tar'
55
 
 
56
 
test_expect_success \
57
 
    'git-tar-tree' \
58
 
    'git-tar-tree HEAD >b2.tar'
59
 
 
60
 
test_expect_success \
61
 
    'git-archive vs. git-tar-tree' \
 
49
     git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
 
50
     git commit-tree $treeid </dev/null)'
 
51
 
 
52
test_expect_success \
 
53
    'git archive' \
 
54
    'git archive HEAD >b.tar'
 
55
 
 
56
test_expect_success \
 
57
    'git tar-tree' \
 
58
    'git tar-tree HEAD >b2.tar'
 
59
 
 
60
test_expect_success \
 
61
    'git archive vs. git tar-tree' \
62
62
    'diff b.tar b2.tar'
63
63
 
64
64
test_expect_success \
70
70
     diff expected.mtime b.mtime'
71
71
 
72
72
test_expect_success \
73
 
    'git-get-tar-commit-id' \
74
 
    'git-get-tar-commit-id <b.tar >b.commitid &&
75
 
     diff .git/$(git-symbolic-ref HEAD) b.commitid'
 
73
    'git get-tar-commit-id' \
 
74
    'git get-tar-commit-id <b.tar >b.commitid &&
 
75
     diff .git/$(git symbolic-ref HEAD) b.commitid'
76
76
 
77
77
test_expect_success \
78
78
    'extract tar archive' \
88
88
    'diff -r a b/a'
89
89
 
90
90
test_expect_success \
91
 
    'git-tar-tree with prefix' \
92
 
    'git-tar-tree HEAD prefix >c.tar'
 
91
    'git tar-tree with prefix' \
 
92
    'git tar-tree HEAD prefix >c.tar'
93
93
 
94
94
test_expect_success \
95
95
    'extract tar archive with prefix' \
105
105
    'diff -r a c/prefix/a'
106
106
 
107
107
test_expect_success \
108
 
    'git-archive --format=zip' \
109
 
    'git-archive --format=zip HEAD >d.zip'
 
108
    'git archive --format=zip' \
 
109
    'git archive --format=zip HEAD >d.zip'
 
110
 
 
111
$UNZIP -v >/dev/null 2>&1
 
112
if [ $? -eq 127 ]; then
 
113
        echo "Skipping ZIP tests, because unzip was not found"
 
114
        test_done
 
115
        exit
 
116
fi
110
117
 
111
118
test_expect_success \
112
119
    'extract ZIP archive' \
122
129
    'diff -r a d/a'
123
130
 
124
131
test_expect_success \
125
 
    'git-archive --format=zip with prefix' \
126
 
    'git-archive --format=zip --prefix=prefix/ HEAD >e.zip'
 
132
    'git archive --format=zip with prefix' \
 
133
    'git archive --format=zip --prefix=prefix/ HEAD >e.zip'
127
134
 
128
135
test_expect_success \
129
136
    'extract ZIP archive with prefix' \
139
146
    'diff -r a e/prefix/a'
140
147
 
141
148
test_expect_success \
142
 
    'git-archive --list outside of a git repo' \
143
 
    'GIT_DIR=some/non-existing/directory git-archive --list'
 
149
    'git archive --list outside of a git repo' \
 
150
    'GIT_DIR=some/non-existing/directory git archive --list'
144
151
 
145
152
test_done