提交 6982ccec 编写于 作者: J Jari Aalto 提交者: Junio C Hamano

git-remote: exit with non-zero status after detecting error in "rm".

Exit with non-zero status when "git remote rm" was told to
remove a non-existing remote.
Signed-off-by: NJari Aalto <jari.aalto@cante.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 2af89f12
......@@ -322,7 +322,7 @@ sub rm_remote {
my ($name) = @_;
if (!exists $remote->{$name}) {
print STDERR "No such remote $name\n";
return;
return 1;
}
$git->command('config', '--remove-section', "remote.$name");
......@@ -337,13 +337,13 @@ sub rm_remote {
}
};
my @refs = $git->command('for-each-ref',
'--format=%(refname) %(objectname)', "refs/remotes/$name");
for (@refs) {
($ref, $object) = split;
$git->command(qw(update-ref -d), $ref, $object);
}
return 0;
}
sub add_usage {
......@@ -461,7 +461,7 @@ sub add_usage {
print STDERR "Usage: git remote rm <remote>\n";
exit(1);
}
rm_remote($ARGV[1]);
exit(rm_remote($ARGV[1]));
}
else {
print STDERR "Usage: git remote\n";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册