mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
* Initial scaffold
* Finish first half of Bats tests
* Add Bats to CI
* Fix CI
* Fix CI
* Fix configuration to set git name and email
* Fix `GIT_CONFIG_{KEY,VALUE}` indexing
* Fix Git config override precedence
* Remove unused and untested function
67 lines
1.4 KiB
Bash
67 lines
1.4 KiB
Bash
# shellcheck shell=bash
|
|
|
|
source "$BATS_TEST_DIRNAME/test_util.sh"
|
|
|
|
setup_file() {
|
|
test_util.setup_file
|
|
}
|
|
|
|
setup() {
|
|
test_util.cd_test
|
|
|
|
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
|
|
}
|