diff options
Diffstat (limited to 'perl')
-rw-r--r-- | perl/FromCPAN/Error.pm | 2 | ||||
-rw-r--r-- | perl/Git.pm | 38 | ||||
-rw-r--r-- | perl/Git/I18N.pm | 2 | ||||
-rw-r--r-- | perl/Git/LoadCPAN.pm | 2 | ||||
-rw-r--r-- | perl/Git/LoadCPAN/Error.pm | 2 | ||||
-rw-r--r-- | perl/Git/LoadCPAN/Mail/Address.pm | 2 | ||||
-rw-r--r-- | perl/Git/Packet.pm | 2 | ||||
-rw-r--r-- | perl/Git/SVN.pm | 2 |
8 files changed, 24 insertions, 28 deletions
diff --git a/perl/FromCPAN/Error.pm b/perl/FromCPAN/Error.pm index d82b713..5b97e03 100644 --- a/perl/FromCPAN/Error.pm +++ b/perl/FromCPAN/Error.pm @@ -1025,7 +1025,7 @@ C<:warndie> handlers added by Paul Evans <leonerd@leonerd.org.uk> =head1 MAINTAINER -Shlomi Fish, L<http://www.shlomifish.org/> . +Shlomi Fish, L<https://www.shlomifish.org/> . =head1 PAST MAINTAINERS diff --git a/perl/Git.pm b/perl/Git.pm index 080cdc2..03bf570 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -7,7 +7,7 @@ Git - Perl interface to the Git version control system package Git; -use 5.008; +use 5.008001; use strict; use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : (); @@ -177,16 +177,27 @@ sub repository { -d $opts{Directory} or throw Error::Simple("Directory not found: $opts{Directory} $!"); my $search = Git->repository(WorkingCopy => $opts{Directory}); - my $dir; + + # This rev-parse will throw an exception if we're not in a + # repository, which is what we want, but it's kind of noisy. + # Ideally we'd capture stderr and relay it, but doing so is + # awkward without depending on it fitting in a pipe buffer. So + # we just reproduce a plausible error message ourselves. + my $out; try { - $dir = $search->command_oneline(['rev-parse', '--git-dir'], - STDERR => 0); + # Note that "--is-bare-repository" must come first, as + # --git-dir output could contain newlines. + $out = $search->command([qw(rev-parse --is-bare-repository --git-dir)], + STDERR => 0); } catch Git::Error::Command with { - $dir = undef; + throw Error::Simple("fatal: not a git repository: $opts{Directory}"); }; + chomp $out; + my ($bare, $dir) = split /\n/, $out, 2; + require Cwd; - if ($dir) { + if ($bare ne 'true') { require File::Spec; File::Spec->file_name_is_absolute($dir) or $dir = $opts{Directory} . '/' . $dir; $opts{Repository} = Cwd::abs_path($dir); @@ -204,21 +215,6 @@ sub repository { $opts{WorkingSubdir} = $prefix; } else { - # A bare repository? Let's see... - $dir = $opts{Directory}; - - unless (-d "$dir/refs" and -d "$dir/objects" and -e "$dir/HEAD") { - # Mimic git-rev-parse --git-dir error message: - throw Error::Simple("fatal: Not a git repository: $dir"); - } - my $search = Git->repository(Repository => $dir); - try { - $search->command('symbolic-ref', 'HEAD'); - } catch Git::Error::Command with { - # Mimic git-rev-parse --git-dir error message: - throw Error::Simple("fatal: Not a git repository: $dir"); - } - $opts{Repository} = Cwd::abs_path($dir); } diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm index 895e759..5454c3a 100644 --- a/perl/Git/I18N.pm +++ b/perl/Git/I18N.pm @@ -1,5 +1,5 @@ package Git::I18N; -use 5.008; +use 5.008001; use strict; use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : (); BEGIN { diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm index 0c360bc..8c7fa80 100644 --- a/perl/Git/LoadCPAN.pm +++ b/perl/Git/LoadCPAN.pm @@ -1,5 +1,5 @@ package Git::LoadCPAN; -use 5.008; +use 5.008001; use strict; use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : (); diff --git a/perl/Git/LoadCPAN/Error.pm b/perl/Git/LoadCPAN/Error.pm index 5d84c20..5cecb0f 100644 --- a/perl/Git/LoadCPAN/Error.pm +++ b/perl/Git/LoadCPAN/Error.pm @@ -1,5 +1,5 @@ package Git::LoadCPAN::Error; -use 5.008; +use 5.008001; use strict; use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : (); use Git::LoadCPAN ( diff --git a/perl/Git/LoadCPAN/Mail/Address.pm b/perl/Git/LoadCPAN/Mail/Address.pm index 340e88a..9f80809 100644 --- a/perl/Git/LoadCPAN/Mail/Address.pm +++ b/perl/Git/LoadCPAN/Mail/Address.pm @@ -1,5 +1,5 @@ package Git::LoadCPAN::Mail::Address; -use 5.008; +use 5.008001; use strict; use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : (); use Git::LoadCPAN ( diff --git a/perl/Git/Packet.pm b/perl/Git/Packet.pm index d144f51..d896e69 100644 --- a/perl/Git/Packet.pm +++ b/perl/Git/Packet.pm @@ -1,5 +1,5 @@ package Git::Packet; -use 5.008; +use 5.008001; use strict; use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : (); BEGIN { diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm index 6ce2e28..7721708 100644 --- a/perl/Git/SVN.pm +++ b/perl/Git/SVN.pm @@ -1752,7 +1752,7 @@ sub tie_for_persistent_memoization { END { # Force cache writeout explicitly instead of waiting for # global destruction to avoid segfault in Storable: - # http://rt.cpan.org/Public/Bug/Display.html?id=36087 + # https://rt.cpan.org/Public/Bug/Display.html?id=36087 unmemoize_svn_mergeinfo_functions(); } |