All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add-interactive: shortcut for add hunk and quit
@ 2011-05-15 12:55 Hermann Gausterer
  2011-05-15 20:30 ` Junio C Hamano
  0 siblings, 1 reply; 15+ messages in thread
From: Hermann Gausterer @ 2011-05-15 12:55 UTC (permalink / raw)
  To: git; +Cc: Hermann Gausterer

[-- Attachment #1: Type: text/plain, Size: 2204 bytes --]

combines the two commands "y"+"q" to one.
i use this if i know that this is the last hunk to add.

Signed-off-by: Hermann Gausterer <git-git-2011@mrq1.org>
---
 Documentation/git-add.txt |    1 +
 git-add--interactive.perl |   15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 9c1d395..76ffd45 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -280,6 +280,7 @@ patch::
        y - stage this hunk
        n - do not stage this hunk
        q - quit; do not stage this hunk nor any of the remaining ones
+       Q - quit; stage this hunk but none of the remaining ones
        a - stage this hunk and all later hunks in the file
        d - do not stage this hunk nor any of the later hunks in the file
        g - select a hunk to go to
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 4f08fe7..db79556 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1123,6 +1123,7 @@ sub help_patch_cmd {
 y - $verb this hunk$target
 n - do not $verb this hunk$target
 q - quit; do not $verb this hunk nor any of the remaining ones
+Q - quit; $verb this hunk but none of the remaining ones
 a - $verb this hunk and all later hunks in the file
 d - do not $verb this hunk nor any of the later hunks in the file
 g - select a hunk to go to
@@ -1313,7 +1314,7 @@ sub patch_update_file {
 		   $hunk[$ix]{TYPE} eq 'deletion' ? ' deletion' :
 		   ' this hunk'),
 		  $patch_mode_flavour{TARGET},
-		  " [y,n,q,a,d,/$other,?]? ";
+		  " [y,n,q,Q,a,d,/$other,?]? ";
 		my $line = prompt_single_character;
 		if ($line) {
 			if ($line =~ /^y/i) {
@@ -1365,7 +1366,17 @@ sub patch_update_file {
 				}
 				next;
 			}
-			elsif ($line =~ /^q/i) {
+			elsif ($line =~ /^q/) {
+				for ($i = 0; $i < $num; $i++) {
+					if (!defined $hunk[$i]{USE}) {
+						$hunk[$i]{USE} = 0;
+					}
+				}
+				$quit = 1;
+				last;
+			}
+			elsif ($line =~ /^Q/) {
+				$hunk[$ix]{USE} = 1;
 				for ($i = 0; $i < $num; $i++) {
 					if (!defined $hunk[$i]{USE}) {
 						$hunk[$i]{USE} = 0;
-- 
1.7.0.4


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-05-19 19:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-15 12:55 [PATCH] add-interactive: shortcut for add hunk and quit Hermann Gausterer
2011-05-15 20:30 ` Junio C Hamano
2011-05-16 16:26   ` [PATCH] add-interactive: shortcut to " Hermann Gausterer
2011-05-16 16:37     ` Matthieu Moy
2011-05-17  5:09       ` Junio C Hamano
2011-05-17  7:12         ` Hermann Gausterer
2011-05-18  6:40           ` Pete Harlan
2011-05-18  6:45             ` Jeff King
2011-05-18  9:26               ` Michael J Gruber
2011-05-18 15:28                 ` Junio C Hamano
2011-05-19 10:16                   ` Thomas Rast
2011-05-19 11:02                     ` Jeff King
2011-05-19 19:25                       ` Junio C Hamano
2011-05-19 19:42                         ` Jeff King
2011-05-18  8:43             ` Hermann Gausterer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.