Compare commits
5 Commits
ac5e6a6a89
...
respect-MA
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f712aa0822 | ||
|
|
8aba6e98d1 | ||
| 31e44f9b70 | |||
|
|
4437b66f67 | ||
|
|
aabd314dde |
@@ -42,6 +42,7 @@ if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
|
||||
. "$DIR/timestamping"
|
||||
|
||||
declare -i MINVERSION=$TIMESTAMPING_VERSION
|
||||
declare -i MAX_COMMITS_TO_CHECK=0
|
||||
declare -A PROCESSED_COMMIT
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
@@ -62,6 +63,16 @@ while [[ $# -gt 0 ]]; do
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
-max|--maxcommits)
|
||||
INTEGER_REGEX='^[0-9]+$'
|
||||
if ! [[ "$2" =~ $INTEGER_REGEX ]]; then
|
||||
echo_error "$KEY: expected positive integer"
|
||||
exit 1
|
||||
fi
|
||||
MAX_COMMITS_TO_CHECK="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
-v|--verbose)
|
||||
OUT_STREAM=/dev/stdout
|
||||
shift # past argument
|
||||
@@ -300,6 +311,13 @@ validate_commit() {
|
||||
# param1: commit hash
|
||||
# returns: 0 if the validation of the commit and all its ancestors succeeded
|
||||
validate_commit_and_parents() {
|
||||
# If MAX_COMMITS_TO_CHECK is zero (or a negative number) then that is understood as "infinity".
|
||||
# So finish if we have reached the limit, and if the limit is not "infinity".
|
||||
NUM_COMMITS_CHECKED=${#PROCESSED_COMMIT[@]}
|
||||
if [[ ${NUM_COMMITS_CHECKED} -ge ${MAX_COMMITS_TO_CHECK} ]] && [[ ${MAX_COMMITS_TO_CHECK} -ge 1 ]]; then
|
||||
# enough commits have already been checked, so return early
|
||||
return 0;
|
||||
fi
|
||||
local COMMIT_HASH="$1"
|
||||
log "validate_commit_and_parents for $COMMIT_HASH"
|
||||
|
||||
@@ -307,6 +325,7 @@ validate_commit_and_parents() {
|
||||
if ! validate_commit "$COMMIT_HASH"; then
|
||||
ALL_PASSED=false
|
||||
fi
|
||||
NUM_COMMITS_CHECKED=${#PROCESSED_COMMIT[@]}
|
||||
local PARENTS=$(git cat-file -p "$COMMIT_HASH" | awk '/^$/{exit} /parent/ {print}' | sed 's/parent //')
|
||||
#iterate over all parents of commit
|
||||
if [ ! -z "$PARENTS" ]; then
|
||||
|
||||
Reference in New Issue
Block a user