Skip to content

Commit

Permalink
Merge branch 'ak/add-i-empty-candidates' into maint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Feb 25, 2015
2 parents 2764442 + a9c4641 commit 7bc4c01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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";
}
Expand Down

0 comments on commit 7bc4c01

Please sign in to comment.