提交 7bc4c01d 编写于 作者: J Junio C Hamano

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
...@@ -515,6 +515,9 @@ sub error_msg { ...@@ -515,6 +515,9 @@ sub error_msg {
sub list_and_choose { sub list_and_choose {
my ($opts, @stuff) = @_; my ($opts, @stuff) = @_;
my (@chosen, @return); my (@chosen, @return);
if (!@stuff) {
return @return;
}
my $i; my $i;
my @prefixes = find_unique_prefixes(@stuff) unless $opts->{LIST_ONLY}; my @prefixes = find_unique_prefixes(@stuff) unless $opts->{LIST_ONLY};
...@@ -725,6 +728,8 @@ sub add_untracked_cmd { ...@@ -725,6 +728,8 @@ sub add_untracked_cmd {
if (@add) { if (@add) {
system(qw(git update-index --add --), @add); system(qw(git update-index --add --), @add);
say_n_paths('added', @add); say_n_paths('added', @add);
} else {
print "No untracked files.\n";
} }
print "\n"; print "\n";
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册