Skip to content

Commit 7deaec9

Browse files
rgsgitster
authored andcommitted
Make git-remote.perl "use strict" compliant
I was looking at some of the perl commands, and noticed that git-remote was the only one to lack a 'use strict' pragma at the top, which could be a good thing for its maintainability. Hopefully, the required changes are minimal. Signed-off-by: Rafael Garcia-Suarez <rgarciasuarez@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ef5b9d6 commit 7deaec9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

git-remote.perl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/perl -w
22

3+
use strict;
34
use Git;
45
my $git = Git->repository();
56

@@ -296,12 +297,13 @@ sub add_remote {
296297

297298
sub update_remote {
298299
my ($name) = @_;
300+
my @remotes;
299301

300302
my $conf = $git->config("remotes." . $name);
301303
if (defined($conf)) {
302304
@remotes = split(' ', $conf);
303305
} elsif ($name eq 'default') {
304-
undef @remotes;
306+
@remotes = ();
305307
for (sort keys %$remote) {
306308
my $do_fetch = $git->config_bool("remote." . $_ .
307309
".skipDefaultUpdate");
@@ -341,7 +343,7 @@ sub rm_remote {
341343
my @refs = $git->command('for-each-ref',
342344
'--format=%(refname) %(objectname)', "refs/remotes/$name");
343345
for (@refs) {
344-
($ref, $object) = split;
346+
my ($ref, $object) = split;
345347
$git->command(qw(update-ref -d), $ref, $object);
346348
}
347349
return 0;
@@ -352,7 +354,7 @@ sub add_usage {
352354
exit(1);
353355
}
354356

355-
local $VERBOSE = 0;
357+
my $VERBOSE = 0;
356358
@ARGV = grep {
357359
if ($_ eq '-v' or $_ eq '--verbose') {
358360
$VERBOSE=1;
@@ -395,7 +397,7 @@ sub add_usage {
395397
update_remote("default");
396398
exit(1);
397399
}
398-
for ($i = 1; $i < @ARGV; $i++) {
400+
for (my $i = 1; $i < @ARGV; $i++) {
399401
update_remote($ARGV[$i]);
400402
}
401403
}

0 commit comments

Comments
 (0)