From fab270a935300dab8e007e9bedbd4ca0b2b099e1 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Tue, 8 Oct 2019 23:07:43 +0200 Subject: pw: add option for pw-apply to create explicit merge commit In some cases where the cover letters are valuable to have in the git log, add a -m option to pw-apply. Signed-off-by: Daniel Borkmann --- README | 5 +++++ pw-apply | 21 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README b/README index 08e2e20..2a7d7fc 100644 --- a/README +++ b/README @@ -113,6 +113,11 @@ Another example without adding optional tags, this time from lore: $ pw-apply -b https://lore.kernel.org/bpf/20190925203745.3173184-1-andriin@fb.com/t.mbox.gz +Similar example with adding an explicit merge commit with branch name +bpf-foo-bar: + + $ pw-apply -s 132626 -m bpf-foo-bar + The pw-apply tool normalizes the patches through mb2q, sorts and groups tags, adds permanent links to the lore list archive and merges them into the master branch with the maintainer's SOB added to the chain. diff --git a/pw-apply b/pw-apply index c2c1320..df07552 100755 --- a/pw-apply +++ b/pw-apply @@ -6,7 +6,7 @@ usage() { cat <<-EOF - usage: pw-apply [-h] [-s SERIES] [-b MBOX] [-a] -- [-C] + usage: pw-apply [-h] [-s SERIES] [-b MBOX] [-m BRANCHNAME] [-a] -- [-C] [-a ACKEDBY] [-r REVIEWEDBY] [-t TESTEDBY] EOF exit @@ -41,12 +41,14 @@ accept_series() branch="mbox" series="" accept="" +merge="" mbox="" head_old=$(git rev-parse --verify HEAD) while true; do case "$1" in -s | --series ) series="$2"; shift 2 ;; -a | --accept ) accept="1"; shift ;; + -m | --merge ) merge="1"; branch="$2"; shift 2 ;; -b | --mbox ) mbox="$2"; shift 2 ;; -h | --help ) usage; break ;; -- ) shift; break ;; @@ -63,8 +65,23 @@ git checkout -b $branch mb2q --mboxout mbox.o "$@" mbox.i git am -3 mbox.o git checkout master -git merge --stat --ff $branch +if [ ! -z "$merge" ]; then + git merge --stat --log --no-edit --no-ff $branch + git commit --amend --signoff -F- <