Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Sun, 30 Sep 2007 06:32:36 +0000 (23:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 30 Sep 2007 06:32:36 +0000 (23:32 -0700)
* maint:
git-remote: exit with non-zero status after detecting errors.
rebase -i: squash should retain the authorship of the _first_ commit
git-add--interactive: Improve behavior on bogus input
git-add--interactive: Allow Ctrl-D to exit

Documentation/git-rebase.txt
git-add--interactive.perl
git-rebase--interactive.sh
git-remote.perl
t/t3404-rebase-interactive.sh
index 0858fa8a6326a0c457bc9b4bb63ae35d3001ef65..e8e75790fc21b403f428b8cca72ab42a072e1b38 100644 (file)
@@ -298,7 +298,7 @@ rebasing.
 If you want to fold two or more commits into one, replace the command
 "pick" with "squash" for the second and subsequent commit.  If the
 commits had different authors, it will attribute the squashed commit to
-the author of the last commit.
+the author of the first commit.
 
 In both cases, or when a "pick" does not succeed (because of merge
 errors), the loop will stop to let you fix things, and you can continue
index 7921cde8cbd3b58f1d7222e9828bf85e10f363e3..be6881496c88fcffc52031e482bfdd8d03faa66c 100755 (executable)
@@ -213,9 +213,13 @@ sub list_and_choose {
                        print ">> ";
                }
                my $line = <STDIN>;
-               last if (!$line);
+               if (!$line) {
+                       print "\n";
+                       $opts->{ON_EOF}->() if $opts->{ON_EOF};
+                       last;
+               }
                chomp $line;
-               my $donesomething = 0;
+               last if $line eq '';
                for my $choice (split(/[\s,]+/, $line)) {
                        my $choose = 1;
                        my ($bottom, $top);
@@ -247,12 +251,11 @@ sub list_and_choose {
                                next TOPLOOP;
                        }
                        for ($i = $bottom-1; $i <= $top-1; $i++) {
-                               next if (@stuff <= $i);
+                               next if (@stuff <= $i || $i < 0);
                                $chosen[$i] = $choose;
-                               $donesomething++;
                        }
                }
-               last if (!$donesomething || $opts->{IMMEDIATE});
+               last if ($opts->{IMMEDIATE});
        }
        for ($i = 0; $i < @stuff; $i++) {
                if ($chosen[$i]) {
@@ -791,6 +794,7 @@ sub main_loop {
                                             SINGLETON => 1,
                                             LIST_FLAT => 4,
                                             HEADER => '*** Commands ***',
+                                            ON_EOF => \&quit_cmd,
                                             IMMEDIATE => 1 }, @cmd);
                if ($it) {
                        eval {
index 8de5b794bf9f98c80f11166621e122e7830051ac..8568a4fd421d7e60512f0dfc37392bded07419b1 100755 (executable)
@@ -276,9 +276,9 @@ do_next () {
                esac
 
                failed=f
+               author_script=$(get_author_ident_from_commit HEAD)
                output git reset --soft HEAD^
                pick_one -n $sha1 || failed=t
-               author_script=$(get_author_ident_from_commit $sha1)
                echo "$author_script" > "$DOTEST"/author-script
                case $failed in
                f)
index b7c1e01d7d7d5dfb68870d65c0f0419138ccc506..79941e40fa66069169d41881ff5c6a433dc34ab5 100755 (executable)
@@ -218,7 +218,7 @@ sub prune_remote {
        my ($name, $ls_remote) = @_;
        if (!exists $remote->{$name}) {
                print STDERR "No such remote $name\n";
-               return;
+               return 1;
        }
        my $info = $remote->{$name};
        update_ls_remote($ls_remote, $info);
@@ -229,13 +229,14 @@ sub prune_remote {
                my @v = $git->command(qw(rev-parse --verify), "$prefix/$to_prune");
                $git->command(qw(update-ref -d), "$prefix/$to_prune", $v[0]);
        }
+       return 0;
 }
 
 sub show_remote {
        my ($name, $ls_remote) = @_;
        if (!exists $remote->{$name}) {
                print STDERR "No such remote $name\n";
-               return;
+               return 1;
        }
        my $info = $remote->{$name};
        update_ls_remote($ls_remote, $info);
@@ -265,6 +266,7 @@ sub show_remote {
                print "  Local branch(es) pushed with 'git push'\n";
                print "    @pushed\n";
        }
+       return 0;
 }
 
 sub add_remote {
@@ -381,9 +383,11 @@ sub add_usage {
                print STDERR "Usage: git remote show <remote>\n";
                exit(1);
        }
+       my $status = 0;
        for (; $i < @ARGV; $i++) {
-               show_remote($ARGV[$i], $ls_remote);
+               $status |= show_remote($ARGV[$i], $ls_remote);
        }
+       exit($status);
 }
 elsif ($ARGV[0] eq 'update') {
        if (@ARGV <= 1) {
@@ -409,9 +413,11 @@ sub add_usage {
                print STDERR "Usage: git remote prune <remote>\n";
                exit(1);
        }
+       my $status = 0;
        for (; $i < @ARGV; $i++) {
-               prune_remote($ARGV[$i], $ls_remote);
+               $status |= prune_remote($ARGV[$i], $ls_remote);
        }
+        exit($status);
 }
 elsif ($ARGV[0] eq 'add') {
        my %opts = ();
index 1af73a47c6af80c51a6ac6df4c5b20529c1a3565..f5ef8c22586525a23f53aaac7b895d634a410805 100755 (executable)
@@ -180,7 +180,7 @@ test_expect_success 'squash' '
 '
 
 test_expect_success 'retain authorship when squashing' '
-       git show HEAD | grep "^Author: Nitfol"
+       git show HEAD | grep "^Author: Twerp Snog"
 '
 
 test_expect_success 'preserve merges with -p' '