Skip to content

Commit

Permalink
Merge pull request #273 from CliffHoogervorst/reverse
Browse files Browse the repository at this point in the history
fix reverse when using path
  • Loading branch information
James Thomson authored Oct 3, 2019
2 parents 2da9820 + de536c6 commit 1acb6a3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
10 changes: 5 additions & 5 deletions assets/check
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion test/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .)},
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions test/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1acb6a3

Please sign in to comment.