mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] git-ptx-patches: support flag -n to get unnumbered patches
@ 2020-09-18 13:10 Uwe Kleine-König
  2020-09-22  7:48 ` Michael Olbrich
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2020-09-18 13:10 UTC (permalink / raw)
  To: ptxdist

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>
---
 scripts/git-ptx-patches | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/git-ptx-patches b/scripts/git-ptx-patches
index 721aa78ba31c..b2bed9664fca 100755
--- a/scripts/git-ptx-patches
+++ b/scripts/git-ptx-patches
@@ -19,6 +19,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."
@@ -37,7 +38,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"
@@ -46,6 +47,9 @@ while getopts "ft:n:" opt; do
 			tag="${OPTARG}"
 			range="${tag}"
 			;;
+		n)
+			numbered_patches=false
+			;;
 	esac
 done
 shift $((${OPTIND} - 1))
@@ -129,7 +133,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
-- 
2.27.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] git-ptx-patches: support flag -n to get unnumbered patches
  2020-09-18 13:10 [ptxdist] [PATCH] git-ptx-patches: support flag -n to get unnumbered patches Uwe Kleine-König
@ 2020-09-22  7:48 ` Michael Olbrich
  2020-09-22  8:47   ` [ptxdist] [PATCH v2] " Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Olbrich @ 2020-09-22  7:48 UTC (permalink / raw)
  To: ptxdist

On Fri, Sep 18, 2020 at 03:10:02PM +0200, Uwe Kleine-König wrote:
> 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.

Hmmm, I prefer numbers for upstream, but if someone want's patches like
this in a BSP, then I don't mind.

However, this patch does not apply on master. Please rebase.

Michael

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  scripts/git-ptx-patches | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/git-ptx-patches b/scripts/git-ptx-patches
> index 721aa78ba31c..b2bed9664fca 100755
> --- a/scripts/git-ptx-patches
> +++ b/scripts/git-ptx-patches
> @@ -19,6 +19,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."
> @@ -37,7 +38,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"
> @@ -46,6 +47,9 @@ while getopts "ft:n:" opt; do
>  			tag="${OPTARG}"
>  			range="${tag}"
>  			;;
> +		n)
> +			numbered_patches=false
> +			;;
>  	esac
>  done
>  shift $((${OPTIND} - 1))
> @@ -129,7 +133,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
> -- 
> 2.27.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ptxdist] [PATCH v2] git-ptx-patches: support flag -n to get unnumbered patches
  2020-09-22  7:48 ` Michael Olbrich
@ 2020-09-22  8:47   ` Uwe Kleine-König
  2020-10-09  6:38     ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2020-09-22  8:47 UTC (permalink / raw)
  To: ptxdist

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>
---
Hello,

On Tue, Sep 22, 2020 at 09:48:44AM +0200, Michael Olbrich wrote:
> Hmmm, I prefer numbers for upstream, but if someone want's patches like
> this in a BSP, then I don't mind.

I actually expected that and so kept the default as is.

> However, this patch does not apply on master. Please rebase.

Done with this patch.

Best regards
Uwe

 scripts/git-ptx-patches | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/git-ptx-patches b/scripts/git-ptx-patches
index fe680273085b..772d20992838 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
-- 
2.28.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [APPLIED] git-ptx-patches: support flag -n to get unnumbered patches
  2020-09-22  8:47   ` [ptxdist] [PATCH v2] " Uwe Kleine-König
@ 2020-10-09  6:38     ` Michael Olbrich
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Olbrich @ 2020-10-09  6:38 UTC (permalink / raw)
  To: ptxdist; +Cc: u.kleine-koenig

Thanks, applied as fc60b543beee61e191dae256a8c7723bd3242dde.

Michael

[sent from post-receive hook]

On Fri, 09 Oct 2020 08:38:33 +0200, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:
> 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>
> 
> diff --git a/scripts/git-ptx-patches b/scripts/git-ptx-patches
> index fe680273085b..772d20992838 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

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-09  6:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 13:10 [ptxdist] [PATCH] git-ptx-patches: support flag -n to get unnumbered patches Uwe Kleine-König
2020-09-22  7:48 ` Michael Olbrich
2020-09-22  8:47   ` [ptxdist] [PATCH v2] " Uwe Kleine-König
2020-10-09  6:38     ` [ptxdist] [APPLIED] " Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox