From e18e7926574a35222bd9c52f544e127cbe8364dc Mon Sep 17 00:00:00 2001 From: chocolateboy Date: Thu, 30 Jul 2015 11:37:41 +0100 Subject: [PATCH] fix eg status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the output of `git status` changed in 1.8.5 (2556b996): the leading core.commentChar prefix ("#" by default) was removed. Fortunately, there's a config option to restore it (status.displayCommentPrefix=true) and git provides a way to set a config option while executing a git command: git -c name=value command --options ... So that mostly restores the expected output. However, there have been other changes in the output since the status parser was last updated. There's one other fix here — "no changes added" is now "nothing added" — but others may be needed now and more will likely be needed in future. The underlying issue is that this data is being parsed out of human-readable output rather than a machine-readable format like that produced by git status --porcelain. --- eg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eg b/eg index 1f630fe2c..4330b7b1a 100755 --- a/eg +++ b/eg @@ -6511,7 +6511,7 @@ sub run { $self->{special_state} = RepoUtil::get_special_state($self->{git_dir}); @ARGV = Util::quote_args(@ARGV); - return ExecUtil::execute("$git_cmd status @ARGV", ignore_ret => 1); + return ExecUtil::execute("$git_cmd -c status.displayCommentPrefix=true status @ARGV", ignore_ret => 1); } sub postprocess { @@ -6573,7 +6573,7 @@ sub postprocess { } elsif ($cur_state < 0) { next if $line !~ m/^# (.+)/; push(@basic_info, $1); - } elsif ($line =~ m/^no changes added to commit/ || + } elsif ($line =~ m/^no(?:thing|\s+changes) added to commit/ || $line =~ m/^# Untracked files not listed/) { next; # Skip this line } elsif ($line =~ m#^(?:\e\[.*?m)?diff --git a/#) {