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
This commit is contained in:
commit
2af89f12c6
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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 = ();
|
||||
|
@ -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' '
|
||||
|
Loading…
Reference in New Issue
Block a user