git-remote rm: add tests and minor fix-ups

This fixes "git remote rm" which always exited with a failure,
corrects indentation, and adds tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2007-09-23 22:29:12 -07:00
parent 1b4cbb5d58
commit 683b56791b
2 changed files with 104 additions and 6 deletions

View File

@ -317,7 +317,7 @@ sub update_remote {
}
sub rm_remote {
my ($name) = @_;
my ($name) = @_;
if (!exists $remote->{$name}) {
print STDERR "No such remote $name\n";
return;
@ -336,7 +336,7 @@ sub rm_remote {
};
my @refs = $git->command('for-each-ref',
my @refs = $git->command('for-each-ref',
'--format=%(refname) %(objectname)', "refs/remotes/$name");
for (@refs) {
($ref, $object) = split;
@ -453,11 +453,9 @@ elsif ($ARGV[0] eq 'add') {
elsif ($ARGV[0] eq 'rm') {
if (@ARGV <= 1) {
print STDERR "Usage: git remote rm <remote>\n";
exit(1);
}
else {
rm_remote($ARGV[1]);
}
exit(1);
rm_remote($ARGV[1]);
}
else {
print STDERR "Usage: git remote\n";