in lib/ES/Repo.pm [51:106]
sub has_changed {
#===================================
my $self = shift;
my ( $title, $branch, $path ) = @_;
$path = $self->normalize_path( $path, $branch );
$branch = $self->normalize_branch( $branch );
local $ENV{GIT_DIR} = $self->git_dir;
my $old_info = $self->_last_commit_info(@_);
my $new;
if ( $self->{keep_hash} ) {
# If we're keeping the hash from the last build but there *isn't* a
# hash that means that the branch wasn't used the last time we built
# this book. That means we'll skip it entirely when building the book
# anyway so we should consider the book not to have changed.
unless ($old_info) {
# New sub_dirs *might* build, but only if the entire book is built
# out of new sub_dirs.
return 'new_sub_dir' if exists $self->{sub_dirs}->{$branch};
return 'not_changed';
}
$new = $self->_last_commit(@_);
} else {
# If we aren't keeping the hash from the last build and there *isn't*
# a hash that means that this is a new repo so we should build it.
return 'changed' unless $old_info;
$new = $self->sha_for_branch( $branch ) or die(
"Remote branch <origin/$branch> doesn't exist in repo "
. $self->name);
}
my $new_info = $new;
# We check sub_dirs *after* the checks above so we can handle sub_dir for
# new sources specially.
return 'changed' if exists $self->{sub_dirs}->{$branch};
if ($self->{keep_hash}) {
return $old_info ne $new_info ? 'changed' : 'not_changed';
}
return 'not_changed' if $old_info eq $new_info;
my $changed;
eval {
$changed = !!run qw(git diff --shortstat),
$self->_last_commit(@_), $new,
'--', $path;
1;
}
|| do { $changed = 1 };
return $changed ? 'changed' : 'not_changed';
}