File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,7 +104,11 @@ esac
104104verify_args=()
105105[[ " $allow_empty " -eq 1 ]] && verify_args+=(--allow-empty)
106106[[ " $amend " -eq 1 ]] && verify_args+=(--amend)
107- bash " $SCRIPT_DIR /verify-staged-for-commit.sh" " ${verify_args[@]} "
107+ if (( ${# verify_args[@]} > 0 )) ; then
108+ bash " $SCRIPT_DIR /verify-staged-for-commit.sh" " ${verify_args[@]} "
109+ else
110+ bash " $SCRIPT_DIR /verify-staged-for-commit.sh"
111+ fi
108112
109113tree=" $( git write-tree) "
110114if [[ " $amend " -eq 1 ]]; then
Original file line number Diff line number Diff line change @@ -35,30 +35,30 @@ for helper in commit-clean.sh verify-staged-for-commit.sh banned_attribution_lib
3535done
3636printf ' base\n' > " $tmp /README.md"
3737git -C " $tmp " add README.md
38- git -C " $tmp " commit -q -m " init"
38+ run_in_repo " $tmp " bash " $tmp /scripts/git/commit-clean.sh " -m " init" > /dev/null
3939
4040printf ' unstaged only\n' > " $tmp /README.md"
4141
42- if run_in_repo " $tmp " bash " $SCRIPT_DIR /commit-clean.sh" -m " should fail unstaged" > /dev/null 2>&1 ; then
42+ if run_in_repo " $tmp " bash " $tmp /scripts/git /commit-clean.sh" -m " should fail unstaged" > /dev/null 2>&1 ; then
4343 fail " commit-clean must reject unstaged-only working tree"
4444else
4545 pass " blocks commit when edits are unstaged"
4646fi
4747
48- if run_in_repo " $tmp " bash " $SCRIPT_DIR /verify-staged-for-commit.sh" > /dev/null 2>&1 ; then
48+ if run_in_repo " $tmp " bash " $tmp /scripts/git /verify-staged-for-commit.sh" > /dev/null 2>&1 ; then
4949 fail " verify-staged must reject empty index"
5050else
5151 pass " verify-staged rejects empty index"
5252fi
5353
5454git -C " $tmp " add README.md
55- if ! run_in_repo " $tmp " bash " $SCRIPT_DIR /verify-staged-for-commit.sh" > /dev/null 2>&1 ; then
55+ if ! run_in_repo " $tmp " bash " $tmp /scripts/git /verify-staged-for-commit.sh" > /dev/null 2>&1 ; then
5656 fail " verify-staged must accept staged delta"
5757else
5858 pass " verify-staged accepts staged delta"
5959fi
6060
61- sha=" $( run_in_repo " $tmp " bash " $SCRIPT_DIR /commit-clean.sh" -m " staged commit" ) "
61+ sha=" $( run_in_repo " $tmp " bash " $tmp /scripts/git /commit-clean.sh" -m " staged commit" ) "
6262if [[ -z " $sha " ]]; then
6363 fail " commit-clean must return a sha for staged commit"
6464else
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ target="${1:?target repo path required}"
66SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
77source_root=" $( cd " $SCRIPT_DIR /../.." && pwd) "
88
9- if ! git -C " $target " rev-parse --is-inside-work-tree > /dev/null 2>&1 ; then
9+ if [[ " $( git -C " $target " rev-parse --is-inside-work-tree 2 > /dev/null) " != " true " ]] ; then
1010 echo " skip: not a git repo: $target " >&2
1111 exit 0
1212fi
You can’t perform that action at this time.
0 commit comments