diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2019-10-08 23:07:43 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-10-08 23:13:43 +0200 |
commit | fab270a935300dab8e007e9bedbd4ca0b2b099e1 (patch) | |
tree | 250c164a2ef898cea3bb3ea2691ab01bfbe9a80b | |
parent | b8beaed7378561e39896327cf266b8816086ae38 (diff) | |
download | pw-fab270a935300dab8e007e9bedbd4ca0b2b099e1.tar.gz |
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 <daniel@iogearbox.net>
-rw-r--r-- | README | 5 | ||||
-rwxr-xr-x | pw-apply | 21 |
2 files changed, 24 insertions, 2 deletions
@@ -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. @@ -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- <<EOF +Merge branch '$branch' + +XYZ says: + +==================== +==================== +EOF +else + git merge --stat --ff $branch +fi git branch -d $branch rm -f mbox.i mbox.o head_new=$(git rev-parse --verify HEAD) pw-check -s $head_old -e $head_new +if [ ! -z "$merge" ]; then + echo "Edit merge commit via: git commit --amend" +fi |