mirror of
https://git.proxmox.com/git/systemd
synced 2025-08-15 08:57:45 +00:00

Upstream commit hooks don't allow empty lines and of course they serve no purpose. Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
54 lines
1.1 KiB
Bash
Executable File
54 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
if [ -z "$*" ] ; then
|
|
echo "Usage: $0 [commit [commit ..]]"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
curbranch=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
# assert we got a branch
|
|
[ -n "$curbranch" ]
|
|
|
|
if [ $curbranch = HEAD ] ; then
|
|
echo "You are not currently on a branch, cannot cherry-pick"
|
|
exit 1
|
|
fi
|
|
|
|
case $curbranch in
|
|
patch-queue/*)
|
|
debbranch=${curbranch/patch-queue\/}
|
|
pqbranch=$curbranch
|
|
;;
|
|
*)
|
|
debbranch=$curbranch
|
|
pqbranch=patch-queue/$curbranch
|
|
;;
|
|
esac
|
|
|
|
commits=$(git rev-parse "$@")
|
|
|
|
if git rev-parse $pqbranch &>/dev/null ; then
|
|
echo
|
|
echo "Will recreate patch-queue branch $pqbranch"
|
|
echo "It was pointing to" $(git rev-parse $pqbranch)
|
|
echo
|
|
fi
|
|
|
|
gbp pq import --force
|
|
|
|
echo "Cherry-picking the following commits:"
|
|
echo "$commits"
|
|
|
|
picks=$(echo "$commits" | xargs echo exec git cherry-pick -x --no-edit --commit)
|
|
|
|
# find the first debian commit
|
|
firstdebian=$(git log -i --grep "topic.*debian" --pretty=%h --reverse $debbranch..$pqbranch | head -1)
|
|
|
|
sedexpr="/$firstdebian/i$picks"
|
|
|
|
GIT_EDITOR="sed -i -e '$sedexpr'" git rebase --interactive --no-autosquash $debbranch
|