git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Weber <marco-oweber@gmx.de>
To: git@vger.kernel.org
Subject: [PATCH 2] renaming git add -i [r]evert -> reset and adding gitt add -i [c]heckout
Date: Sun, 5 Oct 2008 23:46:44 +0200	[thread overview]
Message-ID: <20081005214644.GB32727@gmx.de> (raw)
In-Reply-To: <20081005164124.GA31903@coredump.intra.peff.net>

Hi Jeff, thanks!
I'll try to do it better now (not sure who is the mantainer though, I've
seen that you've commited some lines to this file)..

Both patches apply cleanly against c427559 (master).
You can push enhancements directly to 

git://mawercer.de/git_my_patches 
topic branches: 
        renaming_revert_to_reset
        revert_to_reset_renaming

Sincerly
Marc Weber

============= attachement git show output ============================

commit 852b21bf88b1de784244a6e99de9a53a5c61dd8c
Author: Marc Weber <marco-oweber@gmx.de>
Date:   Sun Oct 5 23:09:04 2008 +0200

    rename the git add -i [r]evert command to [r]eset to use the same term as in git reset
    purpose: decrease possibility of confusion for users with svn background (svn revert = git checkout)
    
    Signed-off-by: Marc Weber <marco-oweber@gmx.de>

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..5352d16 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,8 +498,8 @@ sub update_cmd {
        print "\n";
 }
 
-sub revert_cmd {
-       my @update = list_and_choose({ PROMPT => 'Revert',
+sub reset_cmd {
+       my @update = list_and_choose({ PROMPT => 'Reset',
                                       HEADER => $status_head, },
                                     list_modified());
        if (@update) {
@@ -527,7 +527,7 @@ sub revert_cmd {
                        }
                }
                refresh();
-               say_n_paths('reverted', @update);
+               say_n_paths('reset', @update);
        }
        print "\n";
 }
@@ -1046,7 +1046,7 @@ sub help_cmd {
        print colored $help_color, <<\EOF ;
 status        - show paths with changes
 update        - add working tree state to the staged set of changes
-revert        - revert staged set of changes back to the HEAD version
+reset         - reset staged set of changes back to the HEAD version
 patch         - pick hunks and update selectively
 diff         - view diff between HEAD and index
 add untracked - add contents of untracked files to the staged set of changes
@@ -1070,7 +1070,7 @@ sub process_args {
 sub main_loop {
        my @cmd = ([ 'status', \&status_cmd, ],
                   [ 'update', \&update_cmd, ],
-                  [ 'revert', \&revert_cmd, ],
+                  [ 'reset', \&reset_cmd, ],
                   [ 'add untracked', \&add_untracked_cmd, ],
                   [ 'patch', \&patch_update_cmd, ],
                   [ 'diff', \&diff_cmd, ],








commit b3d438764a7429e1dfacef8f499a0126076ed2bc
Author: Marc Weber <marco-oweber@gmx.de>
Date:   Sun Oct 5 15:15:38 2008 +0000

    renamed revert in ga -i to reset, added [c]heckout

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..32c300f 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -498,8 +498,8 @@ sub update_cmd {
        print "\n";
 }
 
-sub revert_cmd {
-       my @update = list_and_choose({ PROMPT => 'Revert',
+sub reset_cmd {
+       my @update = list_and_choose({ PROMPT => 'Reset',
                                       HEADER => $status_head, },
                                     list_modified());
        if (@update) {
@@ -527,7 +527,31 @@ sub revert_cmd {
                        }
                }
                refresh();
-               say_n_paths('reverted', @update);
+               say_n_paths('reset', @update);
+       }
+       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) {
+                               if ($_->{INDEX_ADDDEL} &&
+                                   $_->{INDEX_ADDDEL} eq 'create') {
+                                       system(qw(git checkout --),
+                                              $_->{VALUE});
+                               }
+                       }
+               }
+               refresh();
+               say_n_paths('checked out', @update);
        }
        print "\n";
 }
@@ -1046,7 +1070,8 @@ sub help_cmd {
        print colored $help_color, <<\EOF ;
 status        - show paths with changes
 update        - add working tree state to the staged set of changes
-revert        - revert staged set of changes back to the HEAD version
+reset         - reset staged set of changes back to the HEAD version
+checkout      - reset working copy file back to the HEAD version
 patch         - pick hunks and update selectively
 diff         - view diff between HEAD and index
 add untracked - add contents of untracked files to the staged set of
changes
@@ -1070,7 +1095,8 @@ sub process_args {
 sub main_loop {
        my @cmd = ([ 'status', \&status_cmd, ],
                   [ 'update', \&update_cmd, ],
-                  [ 'revert', \&revert_cmd, ],
+                  [ 'reset', \&reset_cmd, ],
+                  [ 'checkout', \&checkout_cmd, ],
                   [ 'add untracked', \&add_untracked_cmd, ],
                   [ 'patch', \&patch_update_cmd, ],
                   [ 'diff', \&diff_cmd, ],

  reply	other threads:[~2008-10-05 21:48 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   ` Marc Weber [this message]
2008-10-05 22:11     ` [PATCH 2] renaming git add -i [r]evert -> reset and adding gitt add -i [c]heckout 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
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=20081005214644.GB32727@gmx.de \
    --to=marco-oweber@gmx.de \
    --cc=git@vger.kernel.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).