git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] add--interactive: added [c]heckout

From
MWMarc Weber <marco-oweber@gmx.de>
Date
Oct 6, 2008, 15:55 UTC
Message-ID
<20081006155535.GB28582@gmx.de>
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
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 8 of 10 in “What about renaming ga -i [r]evert to [r]eset ?”
  1. Marc WeberOct 5, 2008
  2. Jeff KingOct 5, 2008
  3. renaming git add -i [r]evert -> reset and adding gitt add -i [c]heckoutMarc Weber, Oct 5, 2008
  4. Jeff KingOct 5, 2008
  5. 1/2 add--interactive: rename [r]evert command to [r]esetMarc Weber, Oct 6, 2008
  6. 2/2 add--interactive: added [c]heckoutMarc Weber, Oct 6, 2008
  7. Shawn O. PearceOct 6, 2008
  8. Marc WeberOct 6, 2008
  9. Shawn O. PearceOct 6, 2008
  10. Marc WeberOct 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.