blob: 8824f5fe663a1c6f83ff36bec2b709122a25d414 (
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
|
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../test_helper'
class TestArchive < Test::Unit::TestCase
def setup
set_file_paths
@git = Git.open(@wdir)
end
def tempfile
Tempfile.new('archive-test').path
end
def test_archive
f = @git.archive('v2.6', tempfile)
assert(File.exists?(f))
f = @git.object('v2.6').archive(tempfile) # writes to given file
assert(File.exists?(f))
f = @git.object('v2.6').archive # returns path to temp file
assert(File.exists?(f))
f = @git.object('v2.6').archive(tempfile, :format => 'zip')
assert(File.file?(f))
f = @git.object('v2.6').archive(tempfile, :format => 'tgz', :prefix => 'test/')
assert(File.exists?(f))
f = @git.object('v2.6').archive(tempfile, :format => 'tar', :prefix => 'test/', :path => 'ex_dir/')
assert(File.exists?(f))
in_temp_dir do
c = Git.clone(@wbare, 'new')
c.chdir do
f = @git.remote('origin').branch('master').archive(tempfile, :format => 'tgz')
assert(File.exists?(f))
end
end
end
end
|