Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ cmd_merge() {
die "merge: $branch changes $vf ($there -> $here): that is a release (just release-patch)"
done
fi
[ -n "$title" ] || title=$(git log --reverse --format=%s origin/main..HEAD | head -n1)
# sed reads to the end: head would stop early, and git log's SIGPIPE (141)
# would end the script under pipefail.
[ -n "$title" ] || title=$(git log --reverse --format=%s origin/main..HEAD | sed -n 1p)
[ -n "$title" ] || die "merge: no commits on $branch beyond main"
if release_title "$title"; then
die "merge: '$title' starts with 'release ' (the title of release pull requests); pass another title"
Expand Down
9 changes: 9 additions & 0 deletions scripts/test_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ expect "merge: squash auto-merge" logged "gh pr merge feat --squash --auto --del
check "merge: an existing pull request is reused" 0 merge VERSION "docs: another title"
expect "merge: no second pull request" not_logged "gh pr create"

# More log output than a pipe holds: a reader that stops after the first line
# must not end the merge (git log gets SIGPIPE, 141 under pipefail).
setup VERSION 1.2.3
echo c >>"$repo/work.txt"
# Through stdin: Linux refuses a single argument over 128 KiB.
head -c 200000 /dev/zero | tr '\0' x | git -C "$repo" commit -q -a -F -
check "merge: a long branch log still gives the first commit's subject" 0 merge VERSION
expect "merge: title = the first commit's subject, not the long one" logged "gh pr create --base main --head feat --title fix the widget"

setup VERSION 1.2.3
git -C "$repo" rm -q VERSION
git -C "$repo" commit -q -m "a repository without a version"
Expand Down
Loading