git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tg export: implement skipping empty patches for quilt mode
@ 2008-11-24 21:56 Uwe Kleine-König
  2008-11-25  8:45 ` martin f krafft
  0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2008-11-24 21:56 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft, Petr Baudis

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: martin f. krafft <madduck@debian.org>
Cc: Petr Baudis <pasky@suse.cz>
---
 tg-export.sh |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/tg-export.sh b/tg-export.sh
index 52af88d..6f1d226 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -7,6 +7,7 @@ name=
 branches=
 output=
 driver=collapse
+skipempty=false
 
 
 ## Parse options
@@ -20,6 +21,8 @@ while [ -n "$1" ]; do
 		driver=quilt;;
 	--collapse)
 		driver=collapse;;
+	-n)
+		skipempty=true;;
 	-*)
 		echo "Usage: tg [...] export ([--collapse] NEWBRANCH | [-b BRANCH1,BRANCH2...] --quilt DIRECTORY)" >&2
 		exit 1;;
@@ -34,6 +37,9 @@ done
 [ -z "$branches" -o "$driver" = "quilt" ] ||
 	die "-b works only with the quilt driver"
 
+! "$skipempty" || [ "$driver" = "quilt" ] ||
+	die "-n is only implemented for the quilt driver"
+
 if [ -z "$branches" ]; then
 	# this check is only needed when no branches have been passed
 	name="$(git symbolic-ref HEAD | sed 's#^refs/heads/##')"
@@ -140,10 +146,14 @@ quilt()
 		return
 	fi
 
-	echo "Exporting $_dep"
-	mkdir -p "$(dirname "$filename")"
-	$tg patch "$_dep" >"$filename"
-	echo "$_dep.diff -p1" >>"$output/series"
+	if "$skipempty" && branch_empty "$_dep"; then
+		echo "Skip empty patch $_dep";
+	else
+		echo "Exporting $_dep"
+		mkdir -p "$(dirname "$filename")"
+		$tg patch "$_dep" >"$filename"
+		echo "$_dep.diff -p1" >>"$output/series"
+	fi
 }
 
 
-- 
1.5.6.5

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

* Re: [PATCH] tg export: implement skipping empty patches for quilt mode
  2008-11-24 21:56 [PATCH] tg export: implement skipping empty patches for quilt mode Uwe Kleine-König
@ 2008-11-25  8:45 ` martin f krafft
  2008-11-25 20:54   ` Uwe Kleine-König
  0 siblings, 1 reply; 9+ messages in thread
From: martin f krafft @ 2008-11-25  8:45 UTC (permalink / raw)
  To: Uwe Kleine-König, git, Petr Baudis

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.11.24.2256 +0100]:
> +skipempty=false

Any reason not to make it default? Why do we even need this option?
Do empty quilt files ever have a purpose?

-- 
 .''`.   martin f. krafft <madduck@debian.org>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
"the husbands of very beautiful women
 belong to the criminal classes."
                                                        -- oscar wilde

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] tg export: implement skipping empty patches for quilt mode
  2008-11-25  8:45 ` martin f krafft
@ 2008-11-25 20:54   ` Uwe Kleine-König
  2008-11-26  9:25     ` martin f krafft
  0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2008-11-25 20:54 UTC (permalink / raw)
  To: martin f krafft; +Cc: git, Petr Baudis

On Tue, Nov 25, 2008 at 09:45:31AM +0100, martin f krafft wrote:
> also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.11.24.2256 +0100]:
> > +skipempty=false
> 
> Any reason not to make it default? Why do we even need this option?
> Do empty quilt files ever have a purpose?
My first implementation did it unconditionally because I think this
should be the default, too.  Then I found in the tg-export section of
README:

	TODO: -n option to prevent exporting of empty patches

I'm not sure if this was meant for collapse or quilt or both.  I assumed
the last and implemented -n as suggested.

Best regards
Uwe

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

* Re: [PATCH] tg export: implement skipping empty patches for quilt mode
  2008-11-25 20:54   ` Uwe Kleine-König
@ 2008-11-26  9:25     ` martin f krafft
  2008-11-26  9:47       ` Uwe Kleine-König
  0 siblings, 1 reply; 9+ messages in thread
From: martin f krafft @ 2008-11-26  9:25 UTC (permalink / raw)
  To: Uwe Kleine-König, git, Petr Baudis

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

also sprach Uwe Kleine-König <ukleinek@strlen.de> [2008.11.25.2154 +0100]:
> 	TODO: -n option to prevent exporting of empty patches
> 
> I'm not sure if this was meant for collapse or quilt or both.  I assumed
> the last and implemented -n as suggested.

Hm, except...

+! "$skipempty" || [ "$driver" = "quilt" ] ||
+       die "-n is only implemented for the quilt driver"
+

so you assumed "quilt", not both.

Anyway, Petr, I'd make this default for all drivers, unless you object.

-- 
 .''`.   martin f. krafft <madduck@debian.org>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
http://www.vcnet.com/bms/

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] tg export: implement skipping empty patches for quilt mode
  2008-11-26  9:25     ` martin f krafft
@ 2008-11-26  9:47       ` Uwe Kleine-König
  0 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2008-11-26  9:47 UTC (permalink / raw)
  To: martin f krafft; +Cc: git, Petr Baudis

On Wed, Nov 26, 2008 at 10:25:42AM +0100, martin f krafft wrote:
> also sprach Uwe Kleine-König <ukleinek@strlen.de> [2008.11.25.2154 +0100]:
> > 	TODO: -n option to prevent exporting of empty patches
> > 
> > I'm not sure if this was meant for collapse or quilt or both.  I assumed
> > the last and implemented -n as suggested.
> 
> Hm, except...
> 
> +! "$skipempty" || [ "$driver" = "quilt" ] ||
> +       die "-n is only implemented for the quilt driver"
> +
> 
> so you assumed "quilt", not both.
hmm, I *implemented* it only for quilt.  That's also the reason for not
having deleted the todo item.
 
> Anyway, Petr, I'd make this default for all drivers, unless you object.
Ack.

If you want I can prepare a patch, but probably it's easier for you to
amend!?

Best regards
Uwe

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

* [PATCH] tg export: implement skipping empty patches for quilt mode
       [not found] <20081126102507.GA29100@piper.oerlikon.madduck.net>
@ 2008-11-26 12:12 ` Uwe Kleine-König
  0 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2008-11-26 12:12 UTC (permalink / raw)
  To: martin f krafft; +Cc: git, Uwe Kleine-König

From: Uwe Kleine-König <ukleinek@strlen.de>

addionally fix the README item for skipping the export of empty patches
not to need an option (-n) as this should be the default.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 README       |    2 +-
 tg-export.sh |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 5bfe3ee..9b92d43 100644
--- a/README
+++ b/README
@@ -414,7 +414,7 @@ tg export
 	TODO: Make stripping of non-essential headers configurable
 	TODO: Make stripping of [PATCH] and other prefixes configurable
 	TODO: --mbox option for other mode of operation
-	TODO: -n option to prevent exporting of empty patches
+	TODO: prevent exporting of empty patches
 	TODO: -a option to export all branches
 	TODO: For quilt exporting, use a temporary branch and remove it when
 	      done - this would allow producing conflict-less series
diff --git a/tg-export.sh b/tg-export.sh
index 52af88d..f133fb8 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -140,10 +140,14 @@ quilt()
 		return
 	fi
 
-	echo "Exporting $_dep"
-	mkdir -p "$(dirname "$filename")"
-	$tg patch "$_dep" >"$filename"
-	echo "$_dep.diff -p1" >>"$output/series"
+	if branch_empty "$_dep"; then
+		echo "Skip empty patch $_dep";
+	else
+		echo "Exporting $_dep"
+		mkdir -p "$(dirname "$filename")"
+		$tg patch "$_dep" >"$filename"
+		echo "$_dep.diff -p1" >>"$output/series"
+	fi
 }
 
 
-- 
1.5.6.5

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

* [PATCH] tg export: implement skipping empty patches for quilt mode
@ 2008-11-26 12:13 Uwe Kleine-König
  2008-11-26 20:39 ` martin f krafft
  0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2008-11-26 12:13 UTC (permalink / raw)
  To: martin f krafft; +Cc: git

addionally fix the README item for skipping the export of empty patches
not to need an option (-n) as this should be the default.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 README       |    2 +-
 tg-export.sh |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 5bfe3ee..9b92d43 100644
--- a/README
+++ b/README
@@ -414,7 +414,7 @@ tg export
 	TODO: Make stripping of non-essential headers configurable
 	TODO: Make stripping of [PATCH] and other prefixes configurable
 	TODO: --mbox option for other mode of operation
-	TODO: -n option to prevent exporting of empty patches
+	TODO: prevent exporting of empty patches
 	TODO: -a option to export all branches
 	TODO: For quilt exporting, use a temporary branch and remove it when
 	      done - this would allow producing conflict-less series
diff --git a/tg-export.sh b/tg-export.sh
index 52af88d..f133fb8 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -140,10 +140,14 @@ quilt()
 		return
 	fi
 
-	echo "Exporting $_dep"
-	mkdir -p "$(dirname "$filename")"
-	$tg patch "$_dep" >"$filename"
-	echo "$_dep.diff -p1" >>"$output/series"
+	if branch_empty "$_dep"; then
+		echo "Skip empty patch $_dep";
+	else
+		echo "Exporting $_dep"
+		mkdir -p "$(dirname "$filename")"
+		$tg patch "$_dep" >"$filename"
+		echo "$_dep.diff -p1" >>"$output/series"
+	fi
 }
 
 
-- 
1.5.6.5

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

* Re: [PATCH] tg export: implement skipping empty patches for quilt mode
  2008-11-26 12:13 Uwe Kleine-König
@ 2008-11-26 20:39 ` martin f krafft
  2008-11-26 21:19   ` Uwe Kleine-König
  0 siblings, 1 reply; 9+ messages in thread
From: martin f krafft @ 2008-11-26 20:39 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.11.26.1313 +0100]:
> addionally fix the README item for skipping the export of empty patches
> not to need an option (-n) as this should be the default.
[...]
> -	TODO: -n option to prevent exporting of empty patches
> +	TODO: prevent exporting of empty patches

Is it still a TODO? Looks like your patch fixes it, no?

-- 
 .''`.   martin f. krafft <madduck@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
 
"the difference between genius and stupidity
 is that genius has it's limits."
                                                    -- albert einstein

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] tg export: implement skipping empty patches for quilt mode
  2008-11-26 20:39 ` martin f krafft
@ 2008-11-26 21:19   ` Uwe Kleine-König
  0 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2008-11-26 21:19 UTC (permalink / raw)
  To: martin f krafft; +Cc: Uwe Kleine-König, git

Hi,

On Wed, Nov 26, 2008 at 09:39:59PM +0100, martin f krafft wrote:
> also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.11.26.1313 +0100]:
> > addionally fix the README item for skipping the export of empty patches
> > not to need an option (-n) as this should be the default.
> [...]
> > -	TODO: -n option to prevent exporting of empty patches
> > +	TODO: prevent exporting of empty patches
> 
> Is it still a TODO? Looks like your patch fixes it, no?
No, it's still a TODO for the collapse driver.

Best regards
Uwe

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

end of thread, other threads:[~2008-11-26 21:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 21:56 [PATCH] tg export: implement skipping empty patches for quilt mode Uwe Kleine-König
2008-11-25  8:45 ` martin f krafft
2008-11-25 20:54   ` Uwe Kleine-König
2008-11-26  9:25     ` martin f krafft
2008-11-26  9:47       ` Uwe Kleine-König
     [not found] <20081126102507.GA29100@piper.oerlikon.madduck.net>
2008-11-26 12:12 ` Uwe Kleine-König
  -- strict thread matches above, loose matches on Subject: below --
2008-11-26 12:13 Uwe Kleine-König
2008-11-26 20:39 ` martin f krafft
2008-11-26 21:19   ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).