Skip to content

Commit 52ed10c

Browse files
tests
Signed-off-by: Michael Standley <michael.standley@tempus.com>
1 parent a9fa3fd commit 52ed10c

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

test/check.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,28 @@ it_can_check_a_repo_having_multiple_root_commits() {
956956
"
957957
}
958958

959+
it_can_check_a_repo_having_multiple_root_commits_from_the_orphan_commit() {
960+
local repo=$(init_repo)
961+
local ref1=$(get_initial_ref $repo)
962+
local ref2=$(make_commit $repo)
963+
964+
# Same as above, but where the current version is the orphan commit.
965+
git -C $repo checkout --orphan temp $ref2
966+
git -C $repo commit -m "second root" --allow-empty
967+
git -C $repo checkout master
968+
git -C $repo merge temp --allow-unrelated-histories -m "merge commit"
969+
second_root=$(git -C $repo rev-parse HEAD^2)
970+
ref3=$(git -C $repo rev-parse HEAD)
971+
972+
check_uri_from $repo $second_root | jq -e "
973+
. == [
974+
{ref: $(echo $ref1 | jq -R .)},
975+
{ref: $(echo $ref2 | jq -R .)},
976+
{ref: $(echo $ref3 | jq -R .)}
977+
]
978+
"
979+
}
980+
959981
it_checks_with_version_depth() {
960982
local repo=$(init_repo)
961983
local ref1=$(make_commit_to_future $repo)
@@ -1040,5 +1062,6 @@ run it_can_check_with_tag_filter_given_branch_first_ref
10401062
run it_can_check_with_tag_regex_given_branch_first_ref
10411063
run it_checks_lastest_commit
10421064
run it_can_check_a_repo_having_multiple_root_commits
1065+
run it_can_check_a_repo_having_multiple_root_commits_from_the_orphan_commit
10431066
run it_checks_with_version_depth
10441067
run it_checks_uri_with_tag_filter_and_version_depth

test/helpers.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ init_repo() {
3939
commit -q --allow-empty -m "init"
4040

4141
# create some bogus branch
42-
git checkout -b bogus
42+
git checkout -q -b bogus
4343

4444
git \
4545
-c user.name='test' \
4646
-c user.email='test@example.com' \
4747
commit -q --allow-empty -m "commit on other branch"
4848

4949
# back to master
50-
git checkout master
50+
git checkout -q master
5151

5252
# print resulting repo
5353
pwd

0 commit comments

Comments
 (0)