{"thread":{"id":"16452","subject":"[PATCH] tg export: implement skipping empty patches for quilt mode","startedAt":"2008-11-24T21:56:50Z","lastAt":"2008-11-26T09:47:29Z","messageCount":5,"participants":["Uwe Kleine-König","martin f krafft"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"96441","messageId":"1227563810-5426-1-git-send-email-u.kleine-koenig@pengutronix.de","threadId":"16452","inReplyTo":null,"subject":"[PATCH] tg export: implement skipping empty patches for quilt mode","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2008-11-24T21:56:50Z","receivedAt":"2008-11-24T21:56:50Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\nCc: martin f. krafft <madduck@debian.org>\nCc: Petr Baudis <pasky@suse.cz>\n---\n tg-export.sh |   18 ++++++++++++++----\n 1 files changed, 14 insertions(+), 4 deletions(-)\n\ndiff --git a/tg-export.sh b/tg-export.sh\nindex 52af88d..6f1d226 100644\n--- a/tg-export.sh\n+++ b/tg-export.sh\n@@ -7,6 +7,7 @@ name=\n branches=\n output=\n driver=collapse\n+skipempty=false\n \n \n ## Parse options\n@@ -20,6 +21,8 @@ while [ -n \"$1\" ]; do\n \t\tdriver=quilt;;\n \t--collapse)\n \t\tdriver=collapse;;\n+\t-n)\n+\t\tskipempty=true;;\n \t-*)\n \t\techo \"Usage: tg [...] export ([--collapse] NEWBRANCH | [-b BRANCH1,BRANCH2...] --quilt DIRECTORY)\" >&2\n \t\texit 1;;\n@@ -34,6 +37,9 @@ done\n [ -z \"$branches\" -o \"$driver\" = \"quilt\" ] ||\n \tdie \"-b works only with the quilt driver\"\n \n+! \"$skipempty\" || [ \"$driver\" = \"quilt\" ] ||\n+\tdie \"-n is only implemented for the quilt driver\"\n+\n if [ -z \"$branches\" ]; then\n \t# this check is only needed when no branches have been passed\n \tname=\"$(git symbolic-ref HEAD | sed 's#^refs/heads/##')\"\n@@ -140,10 +146,14 @@ quilt()\n \t\treturn\n \tfi\n \n-\techo \"Exporting $_dep\"\n-\tmkdir -p \"$(dirname \"$filename\")\"\n-\t$tg patch \"$_dep\" >\"$filename\"\n-\techo \"$_dep.diff -p1\" >>\"$output/series\"\n+\tif \"$skipempty\" && branch_empty \"$_dep\"; then\n+\t\techo \"Skip empty patch $_dep\";\n+\telse\n+\t\techo \"Exporting $_dep\"\n+\t\tmkdir -p \"$(dirname \"$filename\")\"\n+\t\t$tg patch \"$_dep\" >\"$filename\"\n+\t\techo \"$_dep.diff -p1\" >>\"$output/series\"\n+\tfi\n }\n \n \n-- \n1.5.6.5\n"},{"id":"96490","messageId":"20081125084531.GA13122@lapse.rw.madduck.net","threadId":"16452","inReplyTo":"1227563810-5426-1-git-send-email-u.kleine-koenig@pengutronix.de","subject":"Re: [PATCH] tg export: implement skipping empty patches for quilt mode","fromName":"martin f krafft","fromEmail":"madduck@debian.org","sentAt":"2008-11-25T08:45:31Z","receivedAt":"2008-11-25T08:45:31Z","isPatch":true,"sender":{"key":"madduck@debian.org","avatar":null},"body":"also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.11.24.2256 +0100]:\n> +skipempty=false\n\nAny reason not to make it default? Why do we even need this option?\nDo empty quilt files ever have a purpose?\n\n-- \n .''`.   martin f. krafft <madduck@debian.org>\n: :'  :  proud Debian developer, author, administrator, and user\n`. `'`   http://people.debian.org/~madduck - http://debiansystem.info\n  `-  Debian - when you have better things to do than fixing systems\n \n\"the husbands of very beautiful women\n belong to the criminal classes.\"\n                                                        -- oscar wilde\n"},{"id":"96491","messageId":"20081125205440.GA28679@strlen.de","threadId":"16452","inReplyTo":"20081125084531.GA13122@lapse.rw.madduck.net","subject":"Re: [PATCH] tg export: implement skipping empty patches for quilt mode","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@strlen.de","sentAt":"2008-11-25T20:54:40Z","receivedAt":"2008-11-25T20:54:40Z","isPatch":true,"sender":{"key":"ukleinek@strlen.de","avatar":"https://gravatar.com/avatar/71e008a89bd4c9d95c03e4823fa14b01e7f658bfc746c8a735286b945417f2d6?d=mp&s=160"},"body":"On Tue, Nov 25, 2008 at 09:45:31AM +0100, martin f krafft wrote:\n> also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2008.11.24.2256 +0100]:\n> > +skipempty=false\n> \n> Any reason not to make it default? Why do we even need this option?\n> Do empty quilt files ever have a purpose?\nMy first implementation did it unconditionally because I think this\nshould be the default, too.  Then I found in the tg-export section of\nREADME:\n\n\tTODO: -n option to prevent exporting of empty patches\n\nI'm not sure if this was meant for collapse or quilt or both.  I assumed\nthe last and implemented -n as suggested.\n\nBest regards\nUwe\n"},{"id":"96525","messageId":"20081126092542.GE25162@piper.oerlikon.madduck.net","threadId":"16452","inReplyTo":"20081125205440.GA28679@strlen.de","subject":"Re: [PATCH] tg export: implement skipping empty patches for quilt mode","fromName":"martin f krafft","fromEmail":"madduck@debian.org","sentAt":"2008-11-26T09:25:42Z","receivedAt":"2008-11-26T09:25:42Z","isPatch":true,"sender":{"key":"madduck@debian.org","avatar":null},"body":"also sprach Uwe Kleine-König <ukleinek@strlen.de> [2008.11.25.2154 +0100]:\n> \tTODO: -n option to prevent exporting of empty patches\n> \n> I'm not sure if this was meant for collapse or quilt or both.  I assumed\n> the last and implemented -n as suggested.\n\nHm, except...\n\n+! \"$skipempty\" || [ \"$driver\" = \"quilt\" ] ||\n+       die \"-n is only implemented for the quilt driver\"\n+\n\nso you assumed \"quilt\", not both.\n\nAnyway, Petr, I'd make this default for all drivers, unless you object.\n\n-- \n .''`.   martin f. krafft <madduck@debian.org>\n: :'  :  proud Debian developer, author, administrator, and user\n`. `'`   http://people.debian.org/~madduck - http://debiansystem.info\n  `-  Debian - when you have better things to do than fixing systems\n \nhttp://www.vcnet.com/bms/\n"},{"id":"96529","messageId":"20081126094729.GA11169@strlen.de","threadId":"16452","inReplyTo":"20081126092542.GE25162@piper.oerlikon.madduck.net","subject":"Re: [PATCH] tg export: implement skipping empty patches for quilt mode","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@strlen.de","sentAt":"2008-11-26T09:47:29Z","receivedAt":"2008-11-26T09:47:29Z","isPatch":true,"sender":{"key":"ukleinek@strlen.de","avatar":"https://gravatar.com/avatar/71e008a89bd4c9d95c03e4823fa14b01e7f658bfc746c8a735286b945417f2d6?d=mp&s=160"},"body":"On Wed, Nov 26, 2008 at 10:25:42AM +0100, martin f krafft wrote:\n> also sprach Uwe Kleine-König <ukleinek@strlen.de> [2008.11.25.2154 +0100]:\n> > \tTODO: -n option to prevent exporting of empty patches\n> > \n> > I'm not sure if this was meant for collapse or quilt or both.  I assumed\n> > the last and implemented -n as suggested.\n> \n> Hm, except...\n> \n> +! \"$skipempty\" || [ \"$driver\" = \"quilt\" ] ||\n> +       die \"-n is only implemented for the quilt driver\"\n> +\n> \n> so you assumed \"quilt\", not both.\nhmm, I *implemented* it only for quilt.  That's also the reason for not\nhaving deleted the todo item.\n \n> Anyway, Petr, I'd make this default for all drivers, unless you object.\nAck.\n\nIf you want I can prepare a patch, but probably it's easier for you to\namend!?\n\nBest regards\nUwe\n"}]}