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: Jari Aalto <jari.aalto@cante.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jari Aalto committed
Sep 29, 2007 at 23:34 UTC
6982ccecaf32ebf8adfcb66b4225da3b46255621
1 file changed
+3
-3
git-remote.perl
+3
-3
@@ -322,7 +322,7 @@ sub rm_remote {
322
my ($name) = @_;
323
if (!exists $remote->{$name}) {
324
print STDERR "No such remote $name\n";
325
- return;
325
+ return 1;
326
}
327
328
$git->command('config', '--remove-section', "remote.$name");
@@ -337,13 +337,13 @@ sub rm_remote {
337
}
338
};
339
340
-
340
my @refs = $git->command('for-each-ref',
341
'--format=%(refname) %(objectname)', "refs/remotes/$name");
342
for (@refs) {
343
($ref, $object) = split;
344
$git->command(qw(update-ref -d), $ref, $object);
345
}
346
+ return 0;
347
}
348
349
sub add_usage {
@@ -461,7 +461,7 @@ elsif ($ARGV[0] eq 'rm') {
461
print STDERR "Usage: git remote rm <remote>\n";
462
exit(1);
463
}
464
- rm_remote($ARGV[1]);
464
+ exit(rm_remote($ARGV[1]));
465
}
466
else {
467
print STDERR "Usage: git remote\n";