only validate each commit once #7
@@ -42,6 +42,7 @@ if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
|
|||||||
. "$DIR/timestamping"
|
. "$DIR/timestamping"
|
||||||
|
|
||||||
declare -i MINVERSION=$TIMESTAMPING_VERSION
|
declare -i MINVERSION=$TIMESTAMPING_VERSION
|
||||||
|
declare -A PROCESSED_COMMIT
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
KEY="$1"
|
KEY="$1"
|
||||||
@@ -89,6 +90,10 @@ fi
|
|||||||
# tokens, the function will return 0 but echo a warning about the invalid token.
|
# tokens, the function will return 0 but echo a warning about the invalid token.
|
||||||
validate_commit() {
|
validate_commit() {
|
||||||
local COMMIT_HASH="$1"
|
local COMMIT_HASH="$1"
|
||||||
|
if [[ ${PROCESSED_COMMIT[$COMMIT_HASH]} ]]; then
|
||||||
|
log "validate_commit for $COMMIT_HASH has already been validated"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
log "validate_commit for $COMMIT_HASH"
|
log "validate_commit for $COMMIT_HASH"
|
||||||
|
|
||||||
local TIMESTAMP_COMMIT_VERSION
|
local TIMESTAMP_COMMIT_VERSION
|
||||||
@@ -275,6 +280,8 @@ validate_commit() {
|
|||||||
#assert that all extracted timestamps have been processed
|
#assert that all extracted timestamps have been processed
|
||||||
assert "[ $NUM_PROCESSED -eq $NUM_EXTRACTED ]" "All extracted token must be processed."
|
assert "[ $NUM_PROCESSED -eq $NUM_EXTRACTED ]" "All extracted token must be processed."
|
||||||
|
|
||||||
|
PROCESSED_COMMIT[$COMMIT_HASH]=1
|
||||||
|
|
||||||
if [ $NUM_VALID -gt 0 ]; then
|
if [ $NUM_VALID -gt 0 ]; then
|
||||||
if [ $NUM_INVALID -gt 0 ]; then
|
if [ $NUM_INVALID -gt 0 ]; then
|
||||||
echo_warning "Warning: While commit $COMMIT_HASH contains $NUM_VALID valid timestamp tokens and thus is considered proppely timestamped, it also contains $NUM_INVALID invalid timestamp tokens."
|
echo_warning "Warning: While commit $COMMIT_HASH contains $NUM_VALID valid timestamp tokens and thus is considered proppely timestamped, it also contains $NUM_INVALID invalid timestamp tokens."
|
||||||
|
|||||||
Reference in New Issue
Block a user