mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
Merge branch 'ak/add-i-empty-candidates'
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
This commit is contained in:
commit
c1fa3e21bc
@ -515,6 +515,9 @@ sub error_msg {
|
||||
sub list_and_choose {
|
||||
my ($opts, @stuff) = @_;
|
||||
my (@chosen, @return);
|
||||
if (!@stuff) {
|
||||
return @return;
|
||||
}
|
||||
my $i;
|
||||
my @prefixes = find_unique_prefixes(@stuff) unless $opts->{LIST_ONLY};
|
||||
|
||||
@ -725,6 +728,8 @@ sub add_untracked_cmd {
|
||||
if (@add) {
|
||||
system(qw(git update-index --add --), @add);
|
||||
say_n_paths('added', @add);
|
||||
} else {
|
||||
print "No untracked files.\n";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user