From: Junio C Hamano Date: Sun, 30 Sep 2007 06:32:36 +0000 (-0700) Subject: Merge branch 'maint' X-Git-Tag: v1.5.4-rc0~402 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2af89f12c666634e92cd79a6c1af6acc34104c34?hp=f8babc4dabebebd9e95537df6da0408c1c178615 Merge branch 'maint' * 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 --- diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 0858fa8a63..e8e75790fc 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 7921cde8cb..be6881496c 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -213,9 +213,13 @@ sub list_and_choose { print ">> "; } my $line = ; - 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 8de5b794bf..8568a4fd42 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 b7c1e01d7d..79941e40fa 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 @@ sub add_usage { print STDERR "Usage: git remote show \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 \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 1af73a47c6..f5ef8c2258 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' '