fix: an artifact's revision breaks a same-second tie toward the newest commit
CI and images / lint (push) Successful in 2s
CI and images / extension-version (push) Successful in 2s
CI and images / frontend-build (push) Successful in 22s
CI and images / extension-test (push) Successful in 22s
CI and images / backend-lint-and-test (push) Successful in 49s
CI and images / integration (push) Successful in 2m38s
CI and images / sign-extension (push) Successful in 3s
CI and images / build-web (push) Successful in 2m22s
CI and images / smoke-web (push) Successful in 49s
CI and images / build-agent (push) Successful in 6m30s
CI and images / promote (push) Successful in 2s
CI and images / refresh-dev (push) Skipped
CI and images / unattended-failure (push) Skipped
CI and images / lint (push) Successful in 2s
CI and images / extension-version (push) Successful in 2s
CI and images / frontend-build (push) Successful in 22s
CI and images / extension-test (push) Successful in 22s
CI and images / backend-lint-and-test (push) Successful in 49s
CI and images / integration (push) Successful in 2m38s
CI and images / sign-extension (push) Successful in 3s
CI and images / build-web (push) Successful in 2m22s
CI and images / smoke-web (push) Successful in 49s
CI and images / build-agent (push) Successful in 6m30s
CI and images / promote (push) Successful in 2s
CI and images / refresh-dev (push) Skipped
CI and images / unattended-failure (push) Skipped
Two commits pushed together can share a committer second. artifacts.sh sorted the whole "<time> <sha>" line, so a tie went to the larger hash, here the parent. Its revision then named a commit the image's content had moved past, and test_artifact_identity (which takes git's own order among equals) caught it. A stable sort on the timestamp alone keeps git log's order, so the descendant wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -136,9 +136,14 @@ newest() {
|
|||||||
|
|
||||||
# Unquoted on purpose: the pathspec must word-split into separate args.
|
# Unquoted on purpose: the pathspec must word-split into separate args.
|
||||||
# Globbing is off script-wide (`set -f`).
|
# Globbing is off script-wide (`set -f`).
|
||||||
|
#
|
||||||
|
# Newest committer time wins. Two commits pushed together can share a
|
||||||
|
# second, and then the one git log lists first (the descendant, which holds
|
||||||
|
# both changes) wins: a stable sort on the timestamp alone keeps git's order
|
||||||
|
# among equals. Sorting on the whole line would break the tie by hash.
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
set -- "$(cd "$ROOT" && git log --format='%ct %H' HEAD -- $paths \
|
set -- "$(cd "$ROOT" && git log --format='%ct %H' HEAD -- $paths \
|
||||||
| sort -n | tail -1)"
|
| sort -s -k1,1nr | head -1)"
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "artifacts.sh: no commit touches this artifact's shipped files" >&2
|
echo "artifacts.sh: no commit touches this artifact's shipped files" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user