diff options
-rw-r--r-- | Documentation/git-rebase.txt | 2 | ||||
-rwxr-xr-x | git-add--interactive.perl | 14 | ||||
-rwxr-xr-x | git-rebase--interactive.sh | 2 | ||||
-rwxr-xr-x | git-remote.perl | 14 | ||||
-rwxr-xr-x | t/t3404-rebase-interactive.sh | 2 |
5 files changed, 22 insertions, 12 deletions
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 0858fa8a6..e8e75790f 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -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 diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 7921cde8c..be6881496 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -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 { diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 8de5b794b..8568a4fd4 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -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) diff --git a/git-remote.perl b/git-remote.perl index b7c1e01d7..79941e40f 100755 --- a/git-remote.perl +++ b/git-remote.perl @@ -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 @@ elsif ($ARGV[0] eq 'show') { 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 @@ elsif ($ARGV[0] eq 'prune') { 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 = (); diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 1af73a47c..f5ef8c225 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -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' ' |