feat: emit release drill record drafts #159
2 changed files with 19 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ drill_resolve_ref_sha() {
|
|||
$2 == "refs/tags/" ref "^{}" { peeled=$1 }
|
||||
$2 == "refs/heads/" ref { head=$1 }
|
||||
$2 == "refs/tags/" ref { tag=$1 }
|
||||
END { if (peeled) print peeled; else if (head) print head; else if (tag) print tag }
|
||||
END { if (peeled) print peeled; else if (tag) print tag; else if (head) print head }
|
||||
')"
|
||||
[ -n "$sha" ] || return 1
|
||||
printf '%s\n' "$sha"
|
||||
|
|
|
|||
18
test/cli.sh
18
test/cli.sh
|
|
@ -3146,6 +3146,24 @@ check "drill record: default run ID joins version and UTC date" 0 "drill-0.9.1-2
|
|||
# shellcheck disable=SC2016
|
||||
check "drill record: an already exact ref stays exact" 0 "0123456789abcdef0123456789abcdef01234567" \
|
||||
bash -c '. "$1/drill/record.sh"; drill_resolve_ref_sha repo 0123456789abcdef0123456789abcdef01234567' _ "$ROOT"
|
||||
|
||||
REF_FIXTURE="$DRILL_RECORD_DIR/ref-fixture"
|
||||
git init -q "$REF_FIXTURE"
|
||||
git -C "$REF_FIXTURE" config user.name fixture
|
||||
git -C "$REF_FIXTURE" config user.email fixture@example.invalid
|
||||
printf 'branch\n' > "$REF_FIXTURE/value"
|
||||
git -C "$REF_FIXTURE" add value
|
||||
git -C "$REF_FIXTURE" commit -qm branch
|
||||
git -C "$REF_FIXTURE" branch candidate
|
||||
printf 'tag\n' > "$REF_FIXTURE/value"
|
||||
git -C "$REF_FIXTURE" commit -qam tag
|
||||
git -C "$REF_FIXTURE" tag candidate
|
||||
TAG_SHA="$(git -C "$REF_FIXTURE" rev-parse 'refs/tags/candidate^{commit}')"
|
||||
# The installer tries a tag before a branch when both share a name, so the
|
||||
# record resolver must pin the same object rather than merely finding a ref.
|
||||
# shellcheck disable=SC2016
|
||||
check "drill record: tag resolution matches the installer's tag-first channel" 0 "$TAG_SHA" \
|
||||
bash -c '. "$1/drill/record.sh"; drill_resolve_ref_sha "$2" candidate' _ "$ROOT" "$REF_FIXTURE"
|
||||
check "drill: help names --emit-record" 0 "--emit-record <path>" bash "$ROOT/drill/drill.sh" --help
|
||||
check "drill: help names --run-id" 0 "--run-id <id>" bash "$ROOT/drill/drill.sh" --help
|
||||
check "drill: --emit-record needs a value before any mutation" 2 "--emit-record needs a value" \
|
||||
|
|
|
|||
Loading…
Reference in a new issue