{"thread":{"id":"16508","subject":"[PATCH 5/5] Implement 'l' command to display summaries.","startedAt":"2008-11-27T21:10:34Z","lastAt":"2008-11-27T21:10:34Z","messageCount":1,"participants":["William Pursell"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"96639","messageId":"492F0CCA.20905@gmail.com","threadId":"16508","inReplyTo":null,"subject":"[PATCH 5/5] Implement 'l' command to display summaries.","fromName":"William Pursell","fromEmail":"bill.pursell@gmail.com","sentAt":"2008-11-27T21:10:34Z","receivedAt":"2008-11-27T21:10:34Z","isPatch":true,"sender":{"key":"bill.pursell@gmail.com","avatar":"https://gravatar.com/avatar/3ab4313e5dfdc1fedb65206d829ba33f71f56f26e11326979d1b99d5e1c403c9?d=mp&s=160"},"body":"\n\nThe summary information is in place to print out\nthe first added line (NEW), and the first removed\nline (OLD), but it seems that just printing the\nline number context is adequate.  Perhaps one\ncould add config options to print OLD and NEW,\nbut this seems good enough for now.\n---\n  git-add--interactive.perl |   25 ++++++++++++++++++++++++-\n  1 files changed, 24 insertions(+), 1 deletions(-)\n\ndiff --git a/git-add--interactive.perl b/git-add--interactive.perl\nindex ae785e2..6a3d97d 100755\n--- a/git-add--interactive.perl\n+++ b/git-add--interactive.perl\n@@ -824,6 +824,7 @@ sub help_patch_cmd {\n  y - stage this hunk\n  n - do not stage this hunk\n  a - stage this and all the remaining hunks in the file\n+l - print a brief summary of all the hunks in the file\n  d - do not stage this hunk nor any of the remaining hunks in the file\n  j - leave this hunk undecided, see next undecided hunk\n  J - leave this hunk undecided, see next hunk\n@@ -861,6 +862,24 @@ sub patch_update_cmd {\n  \t}\n  }\n\n+sub display_summaries {\n+\tmy $index = shift;\n+\tmy @hunk = @_;\n+\tmy $i = 0;\n+\tprint \"'*' indicates current hunk.  '+' stage, '-' don't stage\\n\";\n+\tfor ( ; $i < @hunk; $i++ ) {\n+\t\tmy $status = \" \";\n+\t\tif( defined $hunk[$i]{USE} ) {\n+\t\t\t$status = $hunk[$i]{USE} ? \"+\" : \"-\";\n+\t\t}\n+\t\tprintf \"%s%d%s: %s\",\n+\t\t\t$i == $index ? \"*\" : \" \",\n+\t\t\t$i,\n+\t\t\t$status,\n+\t\t\t$hunk[$i]{SUMMARY}{LINE};\n+\t}\n+}\n+\n  sub patch_update_file {\n  \tmy ($ix, $num);\n  \tmy $path = shift;\n@@ -904,7 +923,7 @@ sub patch_update_file {\n\n  \twhile (1) {\n  \t\tmy ($commands, $undecided, $i);\n-\t\t$commands = 'ynad';\n+\t\t$commands = 'ynald';\n\n  \t\tif ($num <= $ix) {\n  \t\t\t$ix = 0;\n@@ -961,6 +980,10 @@ sub patch_update_file {\n  \t\t\t\t}\n  \t\t\t\tnext;\n  \t\t\t}\n+\t\t\telsif ($line =~ /^l/i) {\n+\t\t\t\tdisplay_summaries ($ix, @hunk);\n+\t\t\t\tnext;\n+\t\t\t}\n  \t\t\telsif ($line =~ /^d/i) {\n  \t\t\t\twhile ($ix < $num) {\n  \t\t\t\t\tif (!defined $hunk[$ix]{USE}) {\n-- \n1.6.0.4.782.geea74.dirty\n\n\n-- \nWilliam Pursell\n"}]}