{"thread":{"id":"10043","subject":"git-quiltimport and non-existent patches","startedAt":"2007-09-27T09:59:51Z","lastAt":"2007-09-28T14:06:55Z","messageCount":9,"participants":["Geert Uytterhoeven","Junio C Hamano","Dan Nicholson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"54148","messageId":"Pine.LNX.4.62.0709271154440.10467@pademelon.sonytel.be","threadId":"10043","inReplyTo":null,"subject":"git-quiltimport and non-existent patches","fromName":"Geert Uytterhoeven","fromEmail":"geert.uytterhoeven@sonycom.com","sentAt":"2007-09-27T09:59:51Z","receivedAt":"2007-09-27T09:59:51Z","isPatch":false,"sender":{"key":"geert.uytterhoeven@sonycom.com","avatar":null},"body":"\tHi,\n\nUnlike quilt itself, git-quiltimport doesn't ignore non-existent patches.\nInstead it bails out badly, leaving a .dotest directory that must be removed\nmanually. This is with git 1.5.3.2.\n\nIt would be nice if git-quiltimport would just warn about non-existent patches,\njust like quilt.  This will make it work with `markers' we put in our quilt\nseries files. Commenting out the markers is no solution as `quilt series'\ndoesn't show commented-out patches.\n\nThanks!\n\nWith kind regards,\n \nGeert Uytterhoeven\nSoftware Architect\n\nSony Network and Software Technology Center Europe\nThe Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium\n \nPhone:    +32 (0)2 700 8453\t\nFax:      +32 (0)2 700 8622\t\nE-mail:   Geert.Uytterhoeven@sonycom.com\t\nInternet: http://www.sony-europe.com/\n \t\nSony Network and Software Technology Center Europe\t\nA division of Sony Service Centre (Europe) N.V.\t\nRegistered office: Technologielaan 7 · B-1840 Londerzeel · Belgium\t\nVAT BE 0413.825.160 · RPR Brussels\t\nFortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619"},{"id":"54193","messageId":"7vps03uc9x.fsf@gitster.siamese.dyndns.org","threadId":"10043","inReplyTo":"Pine.LNX.4.62.0709271154440.10467@pademelon.sonytel.be","subject":"Re: git-quiltimport and non-existent patches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-27T19:41:14Z","receivedAt":"2007-09-27T19:41:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> writes:\n\n> It would be nice if git-quiltimport would just warn about\n> non-existent patches, just like quilt.  This will make it work\n> with `markers' we put in our quilt series files. Commenting\n> out the markers is no solution as `quilt series' doesn't show\n> commented-out patches.\n\nI cannot decide if this should be the default (that's up to\nheavy users of git-quiltimport script), but something along this\nline should do.  Care to test it and ack?\n\n---\n\n git-quiltimport.sh |   21 +++++++++++++++++----\n 1 files changed, 17 insertions(+), 4 deletions(-)\n\ndiff --git a/git-quiltimport.sh b/git-quiltimport.sh\nindex 74a54d5..3c38959 100755\n--- a/git-quiltimport.sh\n+++ b/git-quiltimport.sh\n@@ -4,6 +4,7 @@ SUBDIRECTORY_ON=Yes\n . git-sh-setup\n \n dry_run=\"\"\n+error_empty=t\n quilt_author=\"\"\n while test $# != 0\n do\n@@ -25,6 +26,11 @@ do\n \t\tdry_run=1\n \t\t;;\n \n+\t--expect-marker)\n+\t\tshift\n+\t\terror_empty=\n+\t\t;;\n+\n \t--pa=*|--pat=*|--patc=*|--patch=*|--patche=*|--patches=*)\n \t\tQUILT_PATCHES=$(expr \"z$1\" : 'z-[^=]*\\(.*\\)')\n \t\tshift\n@@ -74,10 +80,17 @@ for patch_name in $(grep -v '^#' < \"$QUILT_PATCHES/series\" ); do\n \techo $patch_name\n \tgit mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n \t\t<\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n-\ttest -s \"$tmp_patch\" || {\n-\t\techo \"Patch is empty.  Was it split wrong?\"\n-\t\texit 1\n-\t}\n+\tif test ! -s \"$tmp_patch\"\n+\tthen\n+\t\tif test -z \"$error_empty\"\n+\t\tthen\n+\t\t\techo \"Patch is empty.  Was it split wrong?\"\n+\t\t\texit 1\n+\t\telse\n+\t\t\techo \"Marker seen.\"\n+\t\t\tcontinue\n+\t\tfi\n+\tfi\n \n \t# Parse the author information\n \texport GIT_AUTHOR_NAME=$(sed -ne 's/Author: //p' \"$tmp_info\")\n"},{"id":"54199","messageId":"1190925059-5233-1-git-send-email-dbn.lists@gmail.com","threadId":"10043","inReplyTo":"Pine.LNX.4.62.0709271154440.10467@pademelon.sonytel.be","subject":"[PATCH] quiltimport: Skip non-existent patches","fromName":"Dan Nicholson","fromEmail":"dbn.lists@gmail.com","sentAt":"2007-09-27T20:30:59Z","receivedAt":"2007-09-27T20:30:59Z","isPatch":true,"sender":{"key":"dbn.lists@gmail.com","avatar":null},"body":"When quiltimport encounters a non-existent patch in the series file,\njust skip to the next patch. This matches the behavior of quilt.\n\nSigned-off-by: Dan Nicholson <dbn.lists@gmail.com>\n---\n git-quiltimport.sh |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/git-quiltimport.sh b/git-quiltimport.sh\nindex 74a54d5..880c81d 100755\n--- a/git-quiltimport.sh\n+++ b/git-quiltimport.sh\n@@ -71,6 +71,10 @@ commit=$(git rev-parse HEAD)\n \n mkdir $tmp_dir || exit 2\n for patch_name in $(grep -v '^#' < \"$QUILT_PATCHES/series\" ); do\n+\tif ! [ -f \"$QUILT_PATCHES/$patch_name\" ] ; then\n+\t\techo \"$patch_name doesn't exist. Skipping.\"\n+\t\tcontinue\n+\tfi\n \techo $patch_name\n \tgit mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n \t\t<\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n-- \n1.5.3.2\n"},{"id":"54201","messageId":"loom.20070927T203413-499@post.gmane.org","threadId":"10043","inReplyTo":"1190925059-5233-1-git-send-email-dbn.lists@gmail.com","subject":"Re: [PATCH] quiltimport: Skip non-existent patches","fromName":"Dan Nicholson","fromEmail":"dbn.lists@gmail.com","sentAt":"2007-09-27T20:39:54Z","receivedAt":"2007-09-27T20:39:54Z","isPatch":true,"sender":{"key":"dbn.lists@gmail.com","avatar":null},"body":"Dan Nicholson <dbn.lists <at> gmail.com> writes:\n> \n> When quiltimport encounters a non-existent patch in the series file,\n> just skip to the next patch. This matches the behavior of quilt.\n> \n> Signed-off-by: Dan Nicholson <dbn.lists <at> gmail.com>\n> ---\n>  git-quiltimport.sh |    4 ++++\n>  1 files changed, 4 insertions(+), 0 deletions(-)\n> \n> diff --git a/git-quiltimport.sh b/git-quiltimport.sh\n> index 74a54d5..880c81d 100755\n> --- a/git-quiltimport.sh\n> +++ b/git-quiltimport.sh\n> @@ -71,6 +71,10 @@ commit=$(git rev-parse HEAD)\n> \n>  mkdir $tmp_dir || exit 2\n>  for patch_name in $(grep -v '^#' < \"$QUILT_PATCHES/series\" ); do\n> +\tif ! [ -f \"$QUILT_PATCHES/$patch_name\" ] ; then\n> +\t\techo \"$patch_name doesn't exist. Skipping.\"\n> +\t\tcontinue\n> +\tfi\n>  \techo $patch_name\n>  \tgit mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n>  \t\t<\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n\n\nI forgot to mention the rationale for this patch vs. what Junio sent. The issue\nwith Junio's patch is that the failure will occur before $tmp_patch is created\nbecause the script tries to feed git-mailinfo a non-existent patch\n($patch_name). You'll only get past the mailinfo if $patch_name exists.\n\nThe marker setting may still be useful in this context, though, to suppress the\n\"doesn't exist\" message.\n\n--\nDan\n"},{"id":"54203","messageId":"7v1wcju93a.fsf@gitster.siamese.dyndns.org","threadId":"10043","inReplyTo":"loom.20070927T203413-499@post.gmane.org","subject":"Re: [PATCH] quiltimport: Skip non-existent patches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-27T20:50:01Z","receivedAt":"2007-09-27T20:50:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dan Nicholson <dbn.lists@gmail.com> writes:\n\n> Dan Nicholson <dbn.lists <at> gmail.com> writes:\n>> \n>> When quiltimport encounters a non-existent patch in the series file,\n>> just skip to the next patch. This matches the behavior of quilt.\n>> \n>> Signed-off-by: Dan Nicholson <dbn.lists <at> gmail.com>\n>> ---\n>>  git-quiltimport.sh |    4 ++++\n>>  1 files changed, 4 insertions(+), 0 deletions(-)\n>> \n>> diff --git a/git-quiltimport.sh b/git-quiltimport.sh\n>> index 74a54d5..880c81d 100755\n>> --- a/git-quiltimport.sh\n>> +++ b/git-quiltimport.sh\n>> @@ -71,6 +71,10 @@ commit=$(git rev-parse HEAD)\n>> \n>>  mkdir $tmp_dir || exit 2\n>>  for patch_name in $(grep -v '^#' < \"$QUILT_PATCHES/series\" ); do\n>> +\tif ! [ -f \"$QUILT_PATCHES/$patch_name\" ] ; then\n>> +\t\techo \"$patch_name doesn't exist. Skipping.\"\n>> +\t\tcontinue\n>> +\tfi\n>>  \techo $patch_name\n>>  \tgit mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n>>  \t\t<\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n>\n>\n> I forgot to mention the rationale for this patch vs. what Junio sent. The issue\n> with Junio's patch is that the failure will occur before $tmp_patch is created\n> because the script tries to feed git-mailinfo a non-existent patch\n> ($patch_name). You'll only get past the mailinfo if $patch_name exists.\n>\n> The marker setting may still be useful in this context, though, to suppress the\n> \"doesn't exist\" message.\n\nThanks.  I did not know what \"marker\" meant by the original\ncontext and assumed there is a file referred to by the series\nfile but there is no patch in that file.  Instead it seems that\na series file can contain something that is _not_ a file and\nthat is called the marker, right?\n"},{"id":"54209","messageId":"91705d080709271445k62f2867am99114eb0e98fc408@mail.gmail.com","threadId":"10043","inReplyTo":"7v1wcju93a.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] quiltimport: Skip non-existent patches","fromName":"Dan Nicholson","fromEmail":"dbn.lists@gmail.com","sentAt":"2007-09-27T21:45:37Z","receivedAt":"2007-09-27T21:45:37Z","isPatch":true,"sender":{"key":"dbn.lists@gmail.com","avatar":null},"body":"On 9/27/07, Junio C Hamano <gitster@pobox.com> wrote:\n> Dan Nicholson <dbn.lists@gmail.com> writes:\n>\n> > Dan Nicholson <dbn.lists <at> gmail.com> writes:\n> >>\n> >> When quiltimport encounters a non-existent patch in the series file,\n> >> just skip to the next patch. This matches the behavior of quilt.\n> >>\n> >> Signed-off-by: Dan Nicholson <dbn.lists <at> gmail.com>\n> >> ---\n> >>  git-quiltimport.sh |    4 ++++\n> >>  1 files changed, 4 insertions(+), 0 deletions(-)\n> >>\n> >> diff --git a/git-quiltimport.sh b/git-quiltimport.sh\n> >> index 74a54d5..880c81d 100755\n> >> --- a/git-quiltimport.sh\n> >> +++ b/git-quiltimport.sh\n> >> @@ -71,6 +71,10 @@ commit=$(git rev-parse HEAD)\n> >>\n> >>  mkdir $tmp_dir || exit 2\n> >>  for patch_name in $(grep -v '^#' < \"$QUILT_PATCHES/series\" ); do\n> >> +    if ! [ -f \"$QUILT_PATCHES/$patch_name\" ] ; then\n> >> +            echo \"$patch_name doesn't exist. Skipping.\"\n> >> +            continue\n> >> +    fi\n> >>      echo $patch_name\n> >>      git mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n> >>              <\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n> >\n> >\n> > I forgot to mention the rationale for this patch vs. what Junio sent. The issue\n> > with Junio's patch is that the failure will occur before $tmp_patch is created\n> > because the script tries to feed git-mailinfo a non-existent patch\n> > ($patch_name). You'll only get past the mailinfo if $patch_name exists.\n> >\n> > The marker setting may still be useful in this context, though, to suppress the\n> > \"doesn't exist\" message.\n>\n> Thanks.  I did not know what \"marker\" meant by the original\n> context and assumed there is a file referred to by the series\n> file but there is no patch in that file.  Instead it seems that\n> a series file can contain something that is _not_ a file and\n> that is called the marker, right?\n\nI'm actually not a quilt user, but I tested out that patch on a repo\nwith a series containing a non-existent patch. I'm not sure what's\nactually in Geerd's \"marker\", but I believe it's just random text.\n\nWhen you run the command `quilt series', it just lists what's in the\nseries file (minus any comments). And when you run `quilt push' with a\nnon-existent patch, it says \"Patch foo.patch does not exist; applied\nempty patch\"\n\nSo, I think the consistent thing to do is what's in my patch: just\nskip the patch with a message to the user. Maybe the message can be\ntailored to match quilt's output. Actually, it would be best to also\nskip on empty files since quiltimport will bomb in that case as well.\n\n--\nDan\n"},{"id":"54211","messageId":"7vejgjsr6k.fsf@gitster.siamese.dyndns.org","threadId":"10043","inReplyTo":"91705d080709271445k62f2867am99114eb0e98fc408@mail.gmail.com","subject":"Re: [PATCH] quiltimport: Skip non-existent patches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-27T22:02:11Z","receivedAt":"2007-09-27T22:02:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Dan Nicholson\" <dbn.lists@gmail.com> writes:\n\n> When you run the command `quilt series', it just lists what's in the\n> series file (minus any comments). And when you run `quilt push' with a\n> non-existent patch, it says \"Patch foo.patch does not exist; applied\n> empty patch\"\n>\n> So, I think the consistent thing to do is what's in my patch: just\n> skip the patch with a message to the user. Maybe the message can be\n> tailored to match quilt's output. Actually, it would be best to also\n> skip on empty files since quiltimport will bomb in that case as well.\n\nThanks for your helpful explanation.  So perhaps we can do this\non top of yours to be safer and more consistent.\n\n---\n\n git-quiltimport.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-quiltimport.sh b/git-quiltimport.sh\nindex 880c81d..627e023 100755\n--- a/git-quiltimport.sh\n+++ b/git-quiltimport.sh\n@@ -79,8 +79,8 @@ for patch_name in $(grep -v '^#' < \"$QUILT_PATCHES/series\" ); do\n \tgit mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n \t\t<\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n \ttest -s \"$tmp_patch\" || {\n-\t\techo \"Patch is empty.  Was it split wrong?\"\n-\t\texit 1\n+\t\techo \"Patch is empty. Skipping.\"\n+\t\tcontinue\n \t}\n \n \t# Parse the author information\n"},{"id":"54212","messageId":"91705d080709271520r11546361hdbe5e028d415e961@mail.gmail.com","threadId":"10043","inReplyTo":"7vejgjsr6k.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] quiltimport: Skip non-existent patches","fromName":"Dan Nicholson","fromEmail":"dbn.lists@gmail.com","sentAt":"2007-09-27T22:20:46Z","receivedAt":"2007-09-27T22:20:46Z","isPatch":true,"sender":{"key":"dbn.lists@gmail.com","avatar":null},"body":"On 9/27/07, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Dan Nicholson\" <dbn.lists@gmail.com> writes:\n>\n> > When you run the command `quilt series', it just lists what's in the\n> > series file (minus any comments). And when you run `quilt push' with a\n> > non-existent patch, it says \"Patch foo.patch does not exist; applied\n> > empty patch\"\n> >\n> > So, I think the consistent thing to do is what's in my patch: just\n> > skip the patch with a message to the user. Maybe the message can be\n> > tailored to match quilt's output. Actually, it would be best to also\n> > skip on empty files since quiltimport will bomb in that case as well.\n>\n> Thanks for your helpful explanation.  So perhaps we can do this\n> on top of yours to be safer and more consistent.\n>\n> ---\n>\n>  git-quiltimport.sh |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-quiltimport.sh b/git-quiltimport.sh\n> index 880c81d..627e023 100755\n> --- a/git-quiltimport.sh\n> +++ b/git-quiltimport.sh\n> @@ -79,8 +79,8 @@ for patch_name in $(grep -v '^#' < \"$QUILT_PATCHES/series\" ); do\n>         git mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n>                 <\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n>         test -s \"$tmp_patch\" || {\n> -               echo \"Patch is empty.  Was it split wrong?\"\n> -               exit 1\n> +               echo \"Patch is empty. Skipping.\"\n> +               continue\n>         }\n>\n>         # Parse the author information\n\nThat's seems fine. IIUC, mailinfo will only create an empty patch if\nthere's no actual patch content in the original mail/patch. In that\ncase, you probably do want to skip and not bomb. I'd changed my patch\nto do 'if ! [ -s \"$patch\" ]' to catch an empty file, but this is\nprobably better. Hmm, checking `quilt push' on a patch with no actual\npatch bombs. Here's the output:\n\n$ quilt push\nApplying patch foo.patch\npatch: **** Only garbage was found in the patch input.\nPatch foo.patch does not apply (enforce with -f)\n$ echo $?\n1\n$ cat patches/foo.patch\nHere's info about an empty patch.\n\nSo, it might be better to leave the original behavior there to match quilt.\n\n--\nDan\n"},{"id":"54264","messageId":"Pine.LNX.4.62.0709281606430.11943@pademelon.sonytel.be","threadId":"10043","inReplyTo":"1190925059-5233-1-git-send-email-dbn.lists@gmail.com","subject":"Re: [PATCH] quiltimport: Skip non-existent patches","fromName":"Geert Uytterhoeven","fromEmail":"geert.uytterhoeven@sonycom.com","sentAt":"2007-09-28T14:06:55Z","receivedAt":"2007-09-28T14:06:55Z","isPatch":true,"sender":{"key":"geert.uytterhoeven@sonycom.com","avatar":null},"body":"On Thu, 27 Sep 2007, Dan Nicholson wrote:\n> When quiltimport encounters a non-existent patch in the series file,\n> just skip to the next patch. This matches the behavior of quilt.\n> \n> Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>\n\nAcked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>\n\n> ---\n>  git-quiltimport.sh |    4 ++++\n>  1 files changed, 4 insertions(+), 0 deletions(-)\n> \n> diff --git a/git-quiltimport.sh b/git-quiltimport.sh\n> index 74a54d5..880c81d 100755\n> --- a/git-quiltimport.sh\n> +++ b/git-quiltimport.sh\n> @@ -71,6 +71,10 @@ commit=$(git rev-parse HEAD)\n>  \n>  mkdir $tmp_dir || exit 2\n>  for patch_name in $(grep -v '^#' < \"$QUILT_PATCHES/series\" ); do\n> +\tif ! [ -f \"$QUILT_PATCHES/$patch_name\" ] ; then\n> +\t\techo \"$patch_name doesn't exist. Skipping.\"\n> +\t\tcontinue\n> +\tfi\n>  \techo $patch_name\n>  \tgit mailinfo \"$tmp_msg\" \"$tmp_patch\" \\\n>  \t\t<\"$QUILT_PATCHES/$patch_name\" >\"$tmp_info\" || exit 3\n> -- \n> 1.5.3.2\n\nWith kind regards,\n \nGeert Uytterhoeven\nSoftware Architect\n\nSony Network and Software Technology Center Europe\nThe Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium\n \nPhone:    +32 (0)2 700 8453\t\nFax:      +32 (0)2 700 8622\t\nE-mail:   Geert.Uytterhoeven@sonycom.com\t\nInternet: http://www.sony-europe.com/\n \t\nSony Network and Software Technology Center Europe\t\nA division of Sony Service Centre (Europe) N.V.\t\nRegistered office: Technologielaan 7 · B-1840 Londerzeel · Belgium\t\nVAT BE 0413.825.160 · RPR Brussels\t\nFortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619"}]}