X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FGit.pm;h=8410b2fce941d9d8b1e7f5b09557e97059a36146;hb=b9cc3985078111b1fb38de920fd3b7afe3eec542;hp=4f230197186d9af21da28494d8a13ecc81af38f2;hpb=c5c709dcef1b5904467ff2aea3943f00a891dade;p=public-inbox.git
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index 4f230197..8410b2fc 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2019 all contributors
+# Copyright (C) 2014-2020 all contributors
# License: GPLv2 or later
#
# Used to read files from a git repository without excessive forking.
@@ -9,7 +9,7 @@
package PublicInbox::Git;
use strict;
use warnings;
-use POSIX qw(dup2);
+use POSIX ();
use IO::Handle; # ->autoflush
use File::Glob qw(bsd_glob GLOB_NOSORT);
use PublicInbox::Spawn qw(popen_rd);
@@ -55,10 +55,8 @@ sub git_quote ($) {
sub new {
my ($class, $git_dir) = @_;
- my @st;
- $st[7] = $st[10] = 0;
# may contain {-tmp} field for File::Temp::Dir
- bless { git_dir => $git_dir, st => \@st, -git_path => {} }, $class
+ bless { git_dir => $git_dir, alt_st => '', -git_path => {} }, $class
}
sub git_path ($$) {
@@ -79,10 +77,11 @@ sub alternates_changed {
my ($self) = @_;
my $alt = git_path($self, 'objects/info/alternates');
my @st = stat($alt) or return 0;
- my $old_st = $self->{st};
- # 10 - ctime, 7 - size
- return 0 if ($st[10] == $old_st->[10] && $st[7] == $old_st->[7]);
- $self->{st} = \@st;
+
+ # can't rely on 'q' on some 32-bit builds, but `d' works
+ my $st = pack('dd', $st[10], $st[7]); # 10: ctime, 7: size
+ return 0 if $self->{alt_st} eq $st;
+ $self->{alt_st} = $st; # always a true value
}
sub last_check_err {