summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-11-07 11:26:03 -0700
committerSean Whitton <spwhitton@spwhitton.name>2019-11-07 11:26:03 -0700
commita28261e4fcab8cd1218f7ea516c7a440f77c3eaa (patch)
treee55685fa640a7089f3ccb28086012f63b1b92749 /lib
parent71473e12faac3c3ab883c68a571ab6e0fe3b1a63 (diff)
downloaddotfiles-a28261e4fcab8cd1218f7ea516c7a440f77c3eaa.tar.gz
drop git-diff-index and git-diff-files calls
Call to git-status will do the work these calls were doing, and the git-diff-files call, in particular, yielded a lot of false positives.
Diffstat (limited to 'lib')
-rw-r--r--lib/perl5/Local/MrRepo/Repo/Git.pm43
1 files changed, 3 insertions, 40 deletions
diff --git a/lib/perl5/Local/MrRepo/Repo/Git.pm b/lib/perl5/Local/MrRepo/Repo/Git.pm
index 807cd71d..9ae61184 100644
--- a/lib/perl5/Local/MrRepo/Repo/Git.pm
+++ b/lib/perl5/Local/MrRepo/Repo/Git.pm
@@ -73,50 +73,13 @@ sub review {
# 2. Check for uncommitted changes. Note this won't work for
# direct mode git annexes (but I I no longer use any of those).
#
- # check for uncommitted staged changes
- my @diff_index = $self->git->diff_index({cached => 1}, "HEAD");
- # check for unstaged changes to tracked files
- my @diff_files = $self->git->diff_files();
- # check for untracked files
+ # check for uncommitted staged changes, unstaged changes to
+ # tracked files and untracked files
my @porcelain_status = $self->git->RUN("status", {porcelain => 1});
# check for stashes
my @stash_list = $self->git->stash("list");
- # unlocked empty files in v7 git-annex repos will appear in
- # @diff_files even when unmodified. filter them out of
- # @diff_files. note that if unlocked files are actually modified
- # to be empty and that has not been committed, they will appear in
- # @porcelain_status
- if ( @porcelain_status == 0
- && @diff_files != 0
- && $self->isa("Local::MrRepo::Repo::Git::Annex")) {
- # if `git annex version` starts outputting the string ': '
- # other than as the separator between keys and values, we
- # could pass to split a regex here matches the first
- # occurrence of ': ' using a negative lookbehind assertion
- # /(?<!^.*: .*): / (untested; assumes that keys will not
- # contain ': ', which is probably reasonable)
- chomp(my %annex_version_fields
- = map { split ': ' } $self->git->annex('version'));
- # git-annex 7.20191009 introduced the --unlocked file matching
- # option
- if ( $annex_version_fields{'git-annex version'} ge 7.20191009
- && $annex_version_fields{'local repository version'} eq 7) {
- @diff_files = map { (split ' ')[5] } @diff_files;
- my @empty_files
- = map { (stat(rel2abs($_, $self->toplevel)))[7] == 0 ? $_ : () }
- @diff_files;
- my %unlocked_empty_files = map { $_ => undef }
- $self->git->annex('find', '--unlocked', @empty_files);
- @diff_files
- = grep { !exists $unlocked_empty_files{$_} } @diff_files;
- }
- }
-
- unless (@diff_index == 0
- && @diff_files == 0
- && @porcelain_status == 0
- && @stash_list == 0) {
+ unless (@porcelain_status == 0 && @stash_list == 0) {
my @status_lines = map { s/^/ /r }
$self->git->RUN("-c", "color.status=always", "status", "--short"),
# there doesn't appear to be a color output option for git stash