summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2020-09-22 10:47:30 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2020-10-05 10:15:57 +0200
commitfc60b543beee61e191dae256a8c7723bd3242dde (patch)
tree0616f8618c06f549b84f27c2941a1650ac40eea1 /scripts
parent3335094bf7b7ef7c6f98a2a78429eb425e181da1 (diff)
downloadptxdist-fc60b543beee61e191dae256a8c7723bd3242dde.tar.gz
ptxdist-fc60b543beee61e191dae256a8c7723bd3242dde.tar.xz
git-ptx-patches: support flag -n to get unnumbered patches
When passing -n to git-ptx-patches the filenames in the patch stack don't get a number as prefix. The obvious downside is that the order of the patches isn't obvious without the series file and you cannot create a patch stack if two patches share have the same shortlog (which ideally shouldn't happen ...) The obvious advantage is that when a patch is added or removed in the middle of the series there are no renames for the later patches necessary and the changes to series are smaller accordingly. So if the patchstack of openssl used unnumbered patches the commit c45d66cdae4b ("openssl: remove engines-path patch") would only have to touch two lines in series (i.e. the removal of the patch and the changed checksum) and contain no renames. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Message-Id: <20200922084730.11671-1-u.kleine-koenig@pengutronix.de> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/git-ptx-patches17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/git-ptx-patches b/scripts/git-ptx-patches
index fe6802730..772d20992 100755
--- a/scripts/git-ptx-patches
+++ b/scripts/git-ptx-patches
@@ -34,6 +34,7 @@ fi
remove_old=no
tag=base
+numbered_patches=true
if grep -q "$PTX_PATCHES_HEADER" .ptxdist/series; then
echo "Found series file generated by git-ptx-patches."
@@ -52,7 +53,7 @@ if [ "x$1" = "x--force-remove" ]; then
shift
fi
-while getopts "ft:n:" opt; do
+while getopts "ft:n" opt; do
case "${opt}" in
f)
remove_old="force"
@@ -61,6 +62,9 @@ while getopts "ft:n:" opt; do
tag="${OPTARG}"
range="${tag}"
;;
+ n)
+ numbered_patches=false
+ ;;
esac
done
shift $((${OPTIND} - 1))
@@ -144,7 +148,16 @@ fi
GIT_EXTRA_ARGS="$GIT_EXTRA_ARGS --summary --stat=80"
cat .ptxdist/series.0 > .ptxdist/series
-${GIT} format-patch -N $GIT_EXTRA_ARGS ${tagopt} -o .ptxdist/patches/ ${range} | sed -e 's,^.ptxdist/patches/,,' > .ptxdist/series.auto
+${GIT} format-patch -N $GIT_EXTRA_ARGS ${tagopt} -o .ptxdist/patches/ ${range} | while read patch; do
+ if "$numbered_patches"; then
+ patchname="${patch#.ptxdist/patches/}"
+ else
+ patchname="${patch#.ptxdist/patches/[0-9][0-9][0-9][0-9]-}"
+ mv -n "$patch" ".ptxdist/patches/$patchname"
+ fi
+ echo "$patchname"
+done > .ptxdist/series.auto
+
cat .ptxdist/series.auto >> .ptxdist/series
cat .ptxdist/series.1 >> .ptxdist/series
cat .ptxdist/series | _md5sum >> .ptxdist/series