{"thread":{"id":"30365","subject":"[GUILT] [PATCH] Handle empty patches and patches with only a header.","startedAt":"2012-04-30T10:29:55Z","lastAt":"2012-05-02T06:27:33Z","messageCount":3,"participants":["Per Cederqvist","Jeff Sipek"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"190287","messageId":"87haw1342k.fsf@opera.com","threadId":"30365","inReplyTo":null,"subject":"[GUILT] [PATCH] Handle empty patches and patches with only a header.","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2012-04-30T10:29:55Z","receivedAt":"2012-04-30T10:29:55Z","isPatch":true,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"\"git apply --numstat\" in Git 1.7.10 gives an error message unless the\npatch contains a diff, so don't attempt to apply it unless we find a\n\nSigned-off-by: Per Cederqvist <cederp@opera.com>\n---\n guilt |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/guilt b/guilt\nindex 5d619c5..66a671a 100755\n--- a/guilt\n+++ b/guilt\n@@ -622,7 +622,7 @@ push_patch()\n \t\tcd_to_toplevel\n \n \t\t# apply the patch if and only if there is something to apply\n-\t\tif [ `git apply --numstat \"$p\" | wc -l` -gt 0 ]; then\n+\t\tif grep -q '^diff ' \"$p\" && [ `git apply --numstat \"$p\" | wc -l` -gt 0 ]; then\n \t\t\tif [ \"$bail_action\" = abort ]; then\n \t\t\t\treject=\"\"\n \t\t\tfi\n-- \n1.7.10\n"},{"id":"190315","messageId":"20120430164841.GG20761@poseidon.cudanet.local","threadId":"30365","inReplyTo":"87haw1342k.fsf@opera.com","subject":"Re: [GUILT] [PATCH] Handle empty patches and patches with only a header.","fromName":"Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2012-04-30T16:48:42Z","receivedAt":"2012-04-30T16:48:42Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Mon, Apr 30, 2012 at 12:29:55PM +0200, Per Cederqvist wrote:\n> \"git apply --numstat\" in Git 1.7.10 gives an error message unless the\n> patch contains a diff, so don't attempt to apply it unless we find a\n\nFind a what?  Such a cliff-hanger! :)\n\nI assume you mean find a '^diff'.\n\nI'll fix up the commit message before applying.\n\nThanks,\n\nJeff.\n\n> Signed-off-by: Per Cederqvist <cederp@opera.com>\n> ---\n>  guilt |    2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/guilt b/guilt\n> index 5d619c5..66a671a 100755\n> --- a/guilt\n> +++ b/guilt\n> @@ -622,7 +622,7 @@ push_patch()\n>  \t\tcd_to_toplevel\n>  \n>  \t\t# apply the patch if and only if there is something to apply\n> -\t\tif [ `git apply --numstat \"$p\" | wc -l` -gt 0 ]; then\n> +\t\tif grep -q '^diff ' \"$p\" && [ `git apply --numstat \"$p\" | wc -l` -gt 0 ]; then\n>  \t\t\tif [ \"$bail_action\" = abort ]; then\n>  \t\t\t\treject=\"\"\n>  \t\t\tfi\n> -- \n> 1.7.10\n> \n\n-- \nKeyboard not found!\nPress F1 to enter Setup\n"},{"id":"190523","messageId":"4FA0D3D5.5080004@opera.com","threadId":"30365","inReplyTo":"20120430164841.GG20761@poseidon.cudanet.local","subject":"Re: [GUILT] [PATCH] Handle empty patches and patches with only a header.","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2012-05-02T06:27:33Z","receivedAt":"2012-05-02T06:27:33Z","isPatch":true,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"On 04/30/2012 06:48 PM, Jeff Sipek wrote:\n> On Mon, Apr 30, 2012 at 12:29:55PM +0200, Per Cederqvist wrote:\n>> \"git apply --numstat\" in Git 1.7.10 gives an error message unless the\n>> patch contains a diff, so don't attempt to apply it unless we find a\n>\n> Find a what?  Such a cliff-hanger! :)\n>\n> I assume you mean find a '^diff'.\n\nYes. Initially, I searched for \"@@\" and the commit message\nsaid \"diff hunk\", but that heuristic failed if you had a\npatch that just changed the mode of a single file.  So I\nchanged the patch to search for \"^diff\" instead, and\napparently got distracted while editing the commit message.\n\n     /cederp\n\n> I'll fix up the commit message before applying.\n>\n> Thanks,\n>\n> Jeff.\n>\n>> Signed-off-by: Per Cederqvist<cederp@opera.com>\n>> ---\n>>   guilt |    2 +-\n>>   1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/guilt b/guilt\n>> index 5d619c5..66a671a 100755\n>> --- a/guilt\n>> +++ b/guilt\n>> @@ -622,7 +622,7 @@ push_patch()\n>>   \t\tcd_to_toplevel\n>>\n>>   \t\t# apply the patch if and only if there is something to apply\n>> -\t\tif [ `git apply --numstat \"$p\" | wc -l` -gt 0 ]; then\n>> +\t\tif grep -q '^diff ' \"$p\"&&  [ `git apply --numstat \"$p\" | wc -l` -gt 0 ]; then\n>>   \t\t\tif [ \"$bail_action\" = abort ]; then\n>>   \t\t\t\treject=\"\"\n>>   \t\t\tfi\n>> --\n>> 1.7.10\n>>\n>\n"}]}