diff --git a/assets/check b/assets/check index bfbacdeb..9fbcfdf4 100755 --- a/assets/check +++ b/assets/check @@ -118,17 +118,17 @@ get_commit(){ done } -if [ "$reverse" == "true" ] -then - list_command+=" --reverse" -fi - #if no range is selected just grab the last commit that fits the filter if [ -z "$log_range" ] then list_command+="| git rev-list --stdin -1" fi +if [ "$reverse" == "true" ] +then + list_command+="| git rev-list --stdin --first-parent --no-walk --reverse" +fi + if [ -n "$tag_filter" ]; then { if [ -n "$ref" ] && [ -n "$branch" ]; then diff --git a/test/check.sh b/test/check.sh index d87d0812..5dd1f055 100755 --- a/test/check.sh +++ b/test/check.sh @@ -105,7 +105,6 @@ it_can_check_from_a_ref() { local ref1=$(make_commit $repo) local ref2=$(make_commit $repo) local ref3=$(make_commit $repo) - check_uri_from $repo $ref1 | jq -e " . == [ {ref: $(echo $ref1 | jq -R .)}, @@ -263,6 +262,20 @@ it_checks_given_paths() { " } +it_checks_given_paths_ci_skip_disabled() { + local repo=$(init_repo) + local ref1=$(make_commit_to_file $repo file-a) + local ref2=$(make_commit_to_file $repo file-a) + local ref3=$(make_commit_to_file $repo file-a) + check_uri_from_paths_disable_ci_skip $repo $ref1 "file-a" | jq -e " + . == [ + {ref: $(echo $ref1 | jq -R .)}, + {ref: $(echo $ref2 | jq -R .)}, + {ref: $(echo $ref3 | jq -R .)} + ] +" +} + it_checks_given_paths_on_branch() { local repo=$(init_repo) local ref1=$(make_commit_to_file_on_branch_with_path $repo dummy file-b master) @@ -673,6 +686,7 @@ run it_can_check_from_a_first_commit_in_repo run it_can_check_from_a_bogus_sha run it_skips_ignored_paths run it_checks_given_paths +run it_checks_given_paths_ci_skip_disabled run it_checks_given_paths_on_branch run it_checks_given_glob_paths run it_checks_given_ignored_paths diff --git a/test/helpers.sh b/test/helpers.sh index 9d7fc5a3..a6b3f8e0 100644 --- a/test/helpers.sh +++ b/test/helpers.sh @@ -363,6 +363,24 @@ check_uri_from_ignoring() { }" | ${resource_dir}/check | tee /dev/stderr } +check_uri_from_paths_disable_ci_skip() { + local uri=$1 + local ref=$2 + + shift 2 + + jq -n "{ + source: { + uri: $(echo $uri | jq -R .), + paths: $(echo "$@" | jq -R '. | split(" ")'), + disable_ci_skip: true + }, + version: { + ref: $(echo $ref | jq -R .) + } + }" | ${resource_dir}/check | tee /dev/stderr +} + check_uri_from_paths() { local uri=$1 local ref=$2