{"thread":{"id":"22640","subject":"[PATCH] add -p: make the beginning of the hunk easier to see","startedAt":"2010-02-13T11:07:51Z","lastAt":"2010-02-13T16:01:13Z","messageCount":10,"participants":["Björn Gustavsson","Jeff King","Julian Phillips"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"134416","messageId":"4B768807.3030003@gmail.com","threadId":"22640","inReplyTo":null,"subject":"[PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2010-02-13T11:07:51Z","receivedAt":"2010-02-13T11:07:51Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"When using \"git add -p\" to selectively add hunks, I find\nit hard to quickly see where the current hunk starts and\nthe previous stops, because the new hunk starts right\nafter the action prompt for the previous hunk.\n\nFacilitate easy scanning for the beginning of the current\nhunk by adding some blank lines and a line of equal\nsigns before the current hunk.\n\nSigned-off-by: Björn Gustavsson <bgustavsson@gmail.com>\n---\n git-add--interactive.perl |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex cd43c34..4eb7c7c 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -1439,6 +1439,8 @@ sub patch_update_file {\n \t\t\t\t\t !defined $hunk[$ix]{USE});\n \t\t\t}\n \t\t}\n+\t} continue {\n+\t\tprint \"\\n\" x 4, '=' x 72, \"\\n\";\n \t}\n \n \t@hunk = coalesce_overlapping_hunks(@hunk);\n-- \n1.7.0\n"},{"id":"134417","messageId":"20100213112342.GA1299@coredump.intra.peff.net","threadId":"22640","inReplyTo":"4B768807.3030003@gmail.com","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-02-13T11:23:43Z","receivedAt":"2010-02-13T11:23:43Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Feb 13, 2010 at 12:07:51PM +0100, Björn Gustavsson wrote:\n\n> diff --git a/git-add--interactive.perl b/git-add--interactive.perl\n> index cd43c34..4eb7c7c 100755\n> --- a/git-add--interactive.perl\n> +++ b/git-add--interactive.perl\n> @@ -1439,6 +1439,8 @@ sub patch_update_file {\n>  \t\t\t\t\t !defined $hunk[$ix]{USE});\n>  \t\t\t}\n>  \t\t}\n> +\t} continue {\n> +\t\tprint \"\\n\" x 4, '=' x 72, \"\\n\";\n>  \t}\n>  \n>  \t@hunk = coalesce_overlapping_hunks(@hunk);\n\nWow, I find this terrifically ugly. I guess you don't use\ncolor.interactive, which will output a colored hunk header? Or is it\nthat small hunks tend to confused with the previous hunk?\n\n-Peff\n"},{"id":"134418","messageId":"20100213112557.GA5165@coredump.intra.peff.net","threadId":"22640","inReplyTo":"20100213112342.GA1299@coredump.intra.peff.net","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-02-13T11:25:57Z","receivedAt":"2010-02-13T11:25:57Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Feb 13, 2010 at 06:23:43AM -0500, Jeff King wrote:\n\n> On Sat, Feb 13, 2010 at 12:07:51PM +0100, Björn Gustavsson wrote:\n> \n> > diff --git a/git-add--interactive.perl b/git-add--interactive.perl\n> > index cd43c34..4eb7c7c 100755\n> > --- a/git-add--interactive.perl\n> > +++ b/git-add--interactive.perl\n> > @@ -1439,6 +1439,8 @@ sub patch_update_file {\n> >  \t\t\t\t\t !defined $hunk[$ix]{USE});\n> >  \t\t\t}\n> >  \t\t}\n> > +\t} continue {\n> > +\t\tprint \"\\n\" x 4, '=' x 72, \"\\n\";\n> >  \t}\n> >  \n> >  \t@hunk = coalesce_overlapping_hunks(@hunk);\n> \n> Wow, I find this terrifically ugly. I guess you don't use\n\nSide note. Even if we did want to do something like this, your\nimplementation is probably not the right way. It will print the huge\n\"===\" separator even after the last hunk. You would want to keep a\n\"$shown_any\" variable and output the separator before showing a hunk\ninstead.\n\n-Peff\n"},{"id":"134419","messageId":"6672d0161002130333m55372972x909234cae7bd0d82@mail.gmail.com","threadId":"22640","inReplyTo":"20100213112342.GA1299@coredump.intra.peff.net","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2010-02-13T11:33:06Z","receivedAt":"2010-02-13T11:33:06Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"2010/2/13 Jeff King <peff@peff.net>:\n> On Sat, Feb 13, 2010 at 12:07:51PM +0100, Björn Gustavsson wrote:\n>\n> Wow, I find this terrifically ugly. I guess you don't use\n> color.interactive, which will output a colored hunk header?\n\nI do use color.interactive, but I didn't find that distinctive enough.\n\n> Or is it that small hunks tend to confused with the previous hunk?\n\nYes, my hunks were small and I wanted to go through them\nreally quickly, but still be sure that I did correctly, so I found that\nI spent a lot of time making sure that I have found the beginning\nof the current hunk.\n\n-- \nBjörn Gustavsson, Erlang/OTP, Ericsson AB\n"},{"id":"134420","messageId":"6672d0161002130336l6e214a6fh6907db8fa64485be@mail.gmail.com","threadId":"22640","inReplyTo":"20100213112557.GA5165@coredump.intra.peff.net","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2010-02-13T11:36:20Z","receivedAt":"2010-02-13T11:36:20Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"2010/2/13 Jeff King <peff@peff.net>:\n> On Sat, Feb 13, 2010 at 06:23:43AM -0500, Jeff King wrote:\n\n> Side note. Even if we did want to do something like this, your\n> implementation is probably not the right way. It will print the huge\n> \"===\" separator even after the last hunk. You would want to keep a\n> \"$shown_any\" variable and output the separator before showing a hunk\n> instead.\n\nOK. I can fix that if there seems to be any interest to include it.\n\n-- \nBjörn Gustavsson, Erlang/OTP, Ericsson AB\n"},{"id":"134421","messageId":"6672d0161002130342h348765a0j76f63972c4bbe060@mail.gmail.com","threadId":"22640","inReplyTo":"6672d0161002130333m55372972x909234cae7bd0d82@mail.gmail.com","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2010-02-13T11:42:56Z","receivedAt":"2010-02-13T11:42:56Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"2010/2/13 Björn Gustavsson <bgustavsson@gmail.com>:\n> 2010/2/13 Jeff King <peff@peff.net>:\n>> On Sat, Feb 13, 2010 at 12:07:51PM +0100, Björn Gustavsson wrote:\n>>\n>> Wow, I find this terrifically ugly. I guess you don't use\n>> color.interactive, which will output a colored hunk header?\n>\n> I do use color.interactive, but I didn't find that distinctive enough.\n\nAs an alternative to my patch, the color coding could be changed.\nThe beginning of a chunk is now marked with a faint bluish color (the part\nthat looks like \"@@ -42,9 +43,8 @@\").\n\nGiving the \"Stage this hunk...\" prompt some noticeable color (such as red),\ncould make it easier to the see beginning of the hunk. Or\nsimply doing a form-feed (but I suppose not everyone would\nlike that).\n\n-- \nBjörn Gustavsson, Erlang/OTP, Ericsson AB\n"},{"id":"134422","messageId":"20100213115512.GA5472@coredump.intra.peff.net","threadId":"22640","inReplyTo":"6672d0161002130342h348765a0j76f63972c4bbe060@mail.gmail.com","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-02-13T11:55:12Z","receivedAt":"2010-02-13T11:55:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Feb 13, 2010 at 12:42:56PM +0100, Björn Gustavsson wrote:\n\n> As an alternative to my patch, the color coding could be changed.\n> The beginning of a chunk is now marked with a faint bluish color (the part\n> that looks like \"@@ -42,9 +43,8 @@\").\n\nYou can tweak that color with the color.diff.frag config variable.\n\n> Giving the \"Stage this hunk...\" prompt some noticeable color (such as red),\n> could make it easier to the see beginning of the hunk. Or\n> simply doing a form-feed (but I suppose not everyone would\n> like that).\n\nIf you are using color.interactive (or color.ui), that should already be\n\"bold blue\". You can change it to red with color.interactive.prompt.\n\nPersonally, I prefer the color approach. It's less ugly looking (IMHO),\nand it is configurable, so people who don't like it don't have to see\nit. It's also already implemented, though one could perhaps make an\nargument for changing the defaults.\n\n-Peff\n"},{"id":"134436","messageId":"6672d0161002130634j6d9b4994w5cd44405fe9b98a1@mail.gmail.com","threadId":"22640","inReplyTo":"20100213115512.GA5472@coredump.intra.peff.net","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2010-02-13T14:34:00Z","receivedAt":"2010-02-13T14:34:00Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"2010/2/13 Jeff King <peff@peff.net>:\n> On Sat, Feb 13, 2010 at 12:42:56PM +0100, Björn Gustavsson wrote:\n> If you are using color.interactive (or color.ui), that should already be\n> \"bold blue\". You can change it to red with color.interactive.prompt.\n\nOops! Turned out I only had colors for \"diff\", \"status\", and \"branch\",\nso the prompt had had no color. I configured my color settings the\nday I started using git last spring (according to some tutorial or\ngetting started document) and haven't looked at the color\nsettings since.\n\nNow it looks much better.\n\nPersonally, I would prefer if more colors were turned on by\ndefault, or if there were a master setting to turn on all colors\nat once.\n\nThanks for the help!\n\n-- \nBjörn Gustavsson, Erlang/OTP, Ericsson AB\n"},{"id":"134438","messageId":"da1290fab3da0339a2f08dc320e297f9@212.159.54.234","threadId":"22640","inReplyTo":"6672d0161002130634j6d9b4994w5cd44405fe9b98a1@mail.gmail.com","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2010-02-13T15:04:16Z","receivedAt":"2010-02-13T15:04:16Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Sat, 13 Feb 2010 15:34:00 +0100, Björn Gustavsson\n<bgustavsson@gmail.com> wrote:\n> 2010/2/13 Jeff King <peff@peff.net>:\n>> On Sat, Feb 13, 2010 at 12:42:56PM +0100, Björn Gustavsson wrote:\n>> If you are using color.interactive (or color.ui), that should already\nbe\n>> \"bold blue\". You can change it to red with color.interactive.prompt.\n> \n> Oops! Turned out I only had colors for \"diff\", \"status\", and \"branch\",\n> so the prompt had had no color. I configured my color settings the\n> day I started using git last spring (according to some tutorial or\n> getting started document) and haven't looked at the color\n> settings since.\n> \n> Now it looks much better.\n> \n> Personally, I would prefer if more colors were turned on by\n> default, or if there were a master setting to turn on all colors\n> at once.\n\nquoting man git-config:\n\n       color.ui\n           When set to always, always use colors in all git commands which\nare\n           capable of colored output. When false (or never), never. When\nset\n           to true or auto, use colors only when the output is to the\n           terminal. When more specific variables of color.* are set, they\n           always take precedence over this setting. Defaults to false.\n\n-- \nJulian\n"},{"id":"134441","messageId":"6672d0161002130801j1971cd32p9f6de7d250a1b289@mail.gmail.com","threadId":"22640","inReplyTo":"da1290fab3da0339a2f08dc320e297f9@212.159.54.234","subject":"Re: [PATCH] add -p: make the beginning of the hunk easier to see","fromName":"Björn Gustavsson","fromEmail":"bgustavsson@gmail.com","sentAt":"2010-02-13T16:01:13Z","receivedAt":"2010-02-13T16:01:13Z","isPatch":true,"sender":{"key":"bgustavsson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/74840?v=4"},"body":"2010/2/13 Julian Phillips <julian@quantumfyre.co.uk>:\n>> Personally, I would prefer if more colors were turned on by\n>> default, or if there were a master setting to turn on all colors\n>> at once.\n>\n> quoting man git-config:\n>\n>       color.ui\n>           When set to always, always use colors in all git commands which\n> are\n>           capable of colored output. When false (or never), never. When\n> set\n>           to true or auto, use colors only when the output is to the\n>           terminal. When more specific variables of color.* are set, they\n>           always take precedence over this setting. Defaults to false.\n\nThanks!\n\nI have learned a lot today.\n\n-- \nBjörn Gustavsson, Erlang/OTP, Ericsson AB\n"}]}