Don't re-run if there is a result file
Use the existing result file if there is one.
This commit is contained in:
parent
cc405bc2ab
commit
3ad39fddb7
|
@ -13,16 +13,17 @@ REPO="${REPO:-$(pwd)}"
|
|||
[[ ! -d "${REPO}" ]] && exit 2
|
||||
|
||||
result_file="./result"
|
||||
if [[ ! -f "${result_file}" ]]; then
|
||||
for commit_id in $(git -C "${REPO}" rev-list --all --no-merges); do
|
||||
echo "Processing commit ${commit_id}..."
|
||||
# Calculate the legnth of the commit message.
|
||||
commit_message=$(GIT_PAGER=cat git -C "${REPO}" show "${commit_id}" -s --format=%B)
|
||||
commit_message_length=$(echo "${commit_message}" | wc -l)
|
||||
|
||||
for commit_id in $(git -C "${REPO}" rev-list --all --no-merges); do
|
||||
echo "Processing commit ${commit_id}..."
|
||||
# Calculate the legnth of the commit message.
|
||||
commit_message=$(GIT_PAGER=cat git -C "${REPO}" show "${commit_id}" -s --format=%B)
|
||||
commit_message_length=$(echo "${commit_message}" | wc -l)
|
||||
|
||||
# Store the commit IDs and the message length.
|
||||
echo "${commit_message_length} ${commit_id}" >> "${result_file}"
|
||||
done
|
||||
# Store the commit IDs and the message length.
|
||||
echo "${commit_message_length} ${commit_id}" >> "${result_file}"
|
||||
done
|
||||
fi
|
||||
|
||||
# Sort the result file so all files are sorted by the length of the message.
|
||||
sort "${result_file}" --reverse --numeric-sort --output "${result_file}"
|
||||
|
|
Loading…
Reference in a new issue