git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Weber <marco-oweber@gmx.de>
To: git@vger.kernel.org
Cc: spearce@spearce.org
Subject: Re: [PATCH 2/2] add--interactive: added [c]heckout
Date: Mon, 6 Oct 2008 17:55:35 +0200	[thread overview]
Message-ID: <20081006155535.GB28582@gmx.de> (raw)
In-Reply-To: <20081006145137.GC8203@spearce.org>

> Uhm, what is this patch against?  git.git?  If so why are we creating
> a new 1129 line script named something erily close to a script we
> already have?
I accidently added the dist file git-add--interactive instead of
the .perl file.. I'll take more care the next time.
Both patches should apply cleanly against git.git master branch c4275591fb

============= 2/2 starting at commit message =========================
From 741d1e87669ced27a41f8be1b7b65836bd969d5a Mon Sep 17 00:00:00 2001
Message-Id: <741d1e87669ced27a41f8be1b7b65836bd969d5a.1223307236.git.marco-oweber@gmx.de>
In-Reply-To: <b41e1729a8817f0d3cba2be1edc37513a72901dd.1223307236.git.marco-oweber@gmx.de>
References: <b41e1729a8817f0d3cba2be1edc37513a72901dd.1223307236.git.marco-oweber@gmx.de>
From: Marc Weber <marco-oweber@gmx.de>
Date: Mon, 6 Oct 2008 14:32:13 +0000
Subject: [PATCH 2/2] add--interactive: added [c]heckout

this is convinient for cygwin users not using rxvt.

command added last (before quit and help) to not break menu layout and keep exisiting
numbering

Signed-off-by: Marc Weber <marco-oweber@gmx.de>
---
 git-add--interactive.perl |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 5352d16..34629b5 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -532,6 +532,27 @@ sub reset_cmd {
 	print "\n";
 }
 
+sub checkout_cmd {
+	my @update = list_and_choose({ PROMPT => 'Checkout',
+				       HEADER => $status_head, },
+				     list_modified());
+	if (@update) {
+		if (is_initial_commit()) {
+			# should never be executed because there can't be modified files
+			print "error: no revision in repo yet\n";
+		}
+		else {
+			for (@update) {
+				system(qw(git checkout --),
+				$_->{VALUE});
+			}
+		}
+		refresh();
+		say_n_paths('checked out', @update);
+	}
+	print "\n";
+}
+
 sub add_untracked_cmd {
 	my @add = list_and_choose({ PROMPT => 'Add untracked' },
 				  list_untracked());
@@ -1074,6 +1095,7 @@ sub main_loop {
 		   [ 'add untracked', \&add_untracked_cmd, ],
 		   [ 'patch', \&patch_update_cmd, ],
 		   [ 'diff', \&diff_cmd, ],
+		   [ 'checkout', \&checkout_cmd, ],
 		   [ 'quit', \&quit_cmd, ],
 		   [ 'help', \&help_cmd, ],
 	);
-- 
1.6.0.2.GIT

  reply	other threads:[~2008-10-06 15:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-05 15:26 What about renaming ga -i [r]evert to [r]eset ? Marc Weber
2008-10-05 16:41 ` Jeff King
2008-10-05 21:46   ` [PATCH 2] renaming git add -i [r]evert -> reset and adding gitt add -i [c]heckout Marc Weber
2008-10-05 22:11     ` Jeff King
2008-10-06 14:46       ` [PATCH 1/2] add--interactive: rename [r]evert command to [r]eset Marc Weber
2008-10-06 14:49         ` [PATCH 2/2] add--interactive: added [c]heckout Marc Weber
2008-10-06 14:51           ` Shawn O. Pearce
2008-10-06 15:55             ` Marc Weber [this message]
2008-10-06 14:55         ` [PATCH 1/2] add--interactive: rename [r]evert command to [r]eset Shawn O. Pearce
2008-10-06 15:51           ` Marc Weber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081006155535.GB28582@gmx.de \
    --to=marco-oweber@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).