File: git-archive-file.bats

package info (click to toggle)
git-extras 7.4.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 2,120 kB
  • sloc: sh: 4,312; python: 994; makefile: 146
file content (66 lines) | stat: -rw-r--r-- 1,412 bytes parent folder | download
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
# shellcheck shell=bash

source "$BATS_TEST_DIRNAME/test_util.sh"

setup_file() {
	test_util.setup_file
}

setup() {
	test_util.cd_test

	test_util.git_init
	printf '%s\n' 'data' > tmpfile
	git add .
	git commit -m 'test: add data'
	git tag 0.1.0 -m 'bump: 0.1.0'
}

@test "archive file on tags branch" {
	git checkout -b tags0.1.0
	run git archive-file
	assert_success

	local describe_output=
	describe_output=$(git describe)
	assert_file_exists "${PWD##*/}.$describe_output.zip"
}

@test "archive file on any not tags branch without default branch" {
	git checkout -b not-tags-branch
	run git archive-file
	assert_success

	local describe_output=
	describe_output=$(git describe --always --long)
	assert_file_exists "${PWD##*/}.$describe_output.not-tags-branch.zip"
}

@test "archive file on any not tags branch with default branch" {
	skip "Not working as expected"

	run git archive-file
	assert_success

	local describe_output=
	describe_output=$(git describe --always --long)
	assert_file_exists "${PWD##*/}.$describe_output.zip"
}

@test "archive file on branch name has slash" {
	git checkout -b feature/slash
	run git archive-file
	assert_success

	local describe_output=
	describe_output=$(git describe --always --long)
	assert_file_exists "${PWD##*/}.$describe_output.feature-slash.zip"
}

@test "archive file on dirname has backslash" {
	skip
}

@test "archive file on tag name has slash" {
	skip
}