Subject: [PATCH v5 06/10] add--interactive.perl: use add--helper --status for status_cmd

From: "Daniel Ferreira via GitGitGadget" <[email-masked]>
Date: Wed, 20 Feb 2019 03:41:32 -0800 (PST)

From: Daniel Ferreira <[email-masked]>

Call the newly introduced add--helper builtin in
status_cmd() instead of relying on add--interactive's Perl
functions to print the numstat.

If an error occurs, it will be reported, but the Perl script will
not exit, since the add--helper is called within an eval block.

As the Perl script will go away soon, so will this scenario, where
the built-in helper is called  from the Perl script. Combined with
the fact that it would be hard to test, we'll pass on adding
a regression test for this.

Mentored-by: Johannes Schindelin <[email-masked]>
Signed-off-by: Daniel Ferreira <[email-masked]>
Signed-off-by: Slavica Djukic <[email-masked]>
Signed-off-by: Ævar Arnfjörð Bjarmason <[email-masked]>
---
 git-add--interactive.perl | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 20eb81cc92..c2c6b4d5e3 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -597,9 +597,8 @@ sub prompt_help_cmd {
 }
 
 sub status_cmd {
-	list_and_choose({ LIST_ONLY => 1, HEADER => $status_head },
-			list_modified());
-	print "\n";
+	my @status_cmd = ("git", "add--helper", "--status");
+	!system(@status_cmd) or die "@status_cmd exited with code $?";
 }
 
 sub say_n_paths {
-- 
gitgitgadget