Skip to content

Commit

Permalink
check.sh: validate replace tag on cached repo
Browse files Browse the repository at this point in the history
In order to validate git fetch --tags we need to use a cached repo with
the source not updated in order to have a diff between the tag replaced.
  • Loading branch information
talset committed Jan 15, 2019
1 parent d9f6cc2 commit da320fa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,20 @@ it_can_check_with_tag_filter_with_bogus_ref() {
"
}

it_can_check_with_tag_filter_with_replaced_tags_from_cache() {

local repo=$(init_repo)
local ref1=$(make_commit_to_branch $repo branch-a)
local ref2=$(make_annotated_tag $repo "staging" "tag branch-a")
local cache_repo=$(make_cache_repo $repo)
local ref3=$(make_commit_to_branch $repo branch-a)
local ref4=$(make_annotated_tag $repo "staging" "tag branch-b")

check_uri_with_tag_filter $cache_repo "staging" | jq -e "
. == [{ref: \"staging\", commit: \"$ref3\"}]
"
}

it_can_check_and_set_git_config() {
local repo=$(init_repo)
local ref=$(make_commit $repo)
Expand Down Expand Up @@ -554,6 +568,7 @@ run it_can_check_with_tag_filter_with_cursor
run it_can_check_with_tag_filter_over_all_branches
run it_can_check_with_tag_filter_over_all_branches_with_cursor
run it_can_check_with_tag_filter_with_bogus_ref
run it_can_check_with_tag_filter_with_replaced_tags_from_cache
run it_can_check_from_head_only_fetching_single_branch
run it_can_check_and_set_git_config
run it_can_check_from_a_ref_and_only_show_merge_commit
Expand Down
15 changes: 15 additions & 0 deletions test/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,21 @@ make_annotated_tag() {
git -C $repo describe --tags --abbrev=0
}

make_cache_repo() {
local repo=$1

ext_repo="$TMPDIR/git-resource-repo-cache"
# copy the current state of the repo
cp -a $repo $ext_repo
cd $ext_repo

# make the initial repo as remote origin
git remote add origin $repo/.git

# print resulting external repo
pwd
}

check_uri() {
jq -n "{
source: {
Expand Down

0 comments on commit da320fa

Please sign in to comment.