Skip to content

Commit 7bc4c01

Browse files
committed
Merge branch 'ak/add-i-empty-candidates' into maint
The interactive "show a list and let the user choose from it" interface "add -i" used showed and prompted to the user even when the candidate list was empty, against which the only "choice" the user could have made was to choose nothing. * ak/add-i-empty-candidates: add -i: return from list_and_choose if there is no candidate
2 parents 2764442 + a9c4641 commit 7bc4c01

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

git-add--interactive.perl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ sub error_msg {
515515
sub list_and_choose {
516516
my ($opts, @stuff) = @_;
517517
my (@chosen, @return);
518+
if (!@stuff) {
519+
return @return;
520+
}
518521
my $i;
519522
my @prefixes = find_unique_prefixes(@stuff) unless $opts->{LIST_ONLY};
520523

@@ -725,6 +728,8 @@ sub add_untracked_cmd {
725728
if (@add) {
726729
system(qw(git update-index --add --), @add);
727730
say_n_paths('added', @add);
731+
} else {
732+
print "No untracked files.\n";
728733
}
729734
print "\n";
730735
}

0 commit comments

Comments
 (0)