git-remote rm: add tests and minor fix-ups
PATCH 1/1 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 <[email protected]>
---
* People seemed to have liked "git remote rm"; additional tests were requested to complete the series when the patch was submitted but they never came, so I ended up doing the janitorial work myself, which led to discovery of breakage in the implementation.
Needless to say, I am not overly amused.
git-remote.perl | 10 ++--- t/t5505-remote.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 6 deletions(-) create mode 100755 t/t5505-remote.sh
git-remote.perl +4 -6
@@ -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";
t/t5505-remote.sh new file +100 -0
100 lines not on this page · raw message
Signature · 1 line
1.5.3.2.1053.g5065