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>
This commit is contained in:
parent
ef5b9d6e22
commit
7deaec9ac7
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
use strict;
|
||||||
use Git;
|
use Git;
|
||||||
my $git = Git->repository();
|
my $git = Git->repository();
|
||||||
|
|
||||||
@ -296,12 +297,13 @@ sub add_remote {
|
|||||||
|
|
||||||
sub update_remote {
|
sub update_remote {
|
||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
|
my @remotes;
|
||||||
|
|
||||||
my $conf = $git->config("remotes." . $name);
|
my $conf = $git->config("remotes." . $name);
|
||||||
if (defined($conf)) {
|
if (defined($conf)) {
|
||||||
@remotes = split(' ', $conf);
|
@remotes = split(' ', $conf);
|
||||||
} elsif ($name eq 'default') {
|
} elsif ($name eq 'default') {
|
||||||
undef @remotes;
|
@remotes = ();
|
||||||
for (sort keys %$remote) {
|
for (sort keys %$remote) {
|
||||||
my $do_fetch = $git->config_bool("remote." . $_ .
|
my $do_fetch = $git->config_bool("remote." . $_ .
|
||||||
".skipDefaultUpdate");
|
".skipDefaultUpdate");
|
||||||
@ -341,7 +343,7 @@ sub rm_remote {
|
|||||||
my @refs = $git->command('for-each-ref',
|
my @refs = $git->command('for-each-ref',
|
||||||
'--format=%(refname) %(objectname)', "refs/remotes/$name");
|
'--format=%(refname) %(objectname)', "refs/remotes/$name");
|
||||||
for (@refs) {
|
for (@refs) {
|
||||||
($ref, $object) = split;
|
my ($ref, $object) = split;
|
||||||
$git->command(qw(update-ref -d), $ref, $object);
|
$git->command(qw(update-ref -d), $ref, $object);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -352,7 +354,7 @@ sub add_usage {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
local $VERBOSE = 0;
|
my $VERBOSE = 0;
|
||||||
@ARGV = grep {
|
@ARGV = grep {
|
||||||
if ($_ eq '-v' or $_ eq '--verbose') {
|
if ($_ eq '-v' or $_ eq '--verbose') {
|
||||||
$VERBOSE=1;
|
$VERBOSE=1;
|
||||||
@ -395,7 +397,7 @@ elsif ($ARGV[0] eq 'update') {
|
|||||||
update_remote("default");
|
update_remote("default");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
for ($i = 1; $i < @ARGV; $i++) {
|
for (my $i = 1; $i < @ARGV; $i++) {
|
||||||
update_remote($ARGV[$i]);
|
update_remote($ARGV[$i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user