* [PATCH] git-add--interactive: return from list_and_choose if there is zero candidates
@ 2015-01-22 8:39 Alexander Kuleshov
0 siblings, 0 replies; only message in thread
From: Alexander Kuleshov @ 2015-01-22 8:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Alexander Kuleshov
This patch introduce the check in list_and_choose() routine for the list. If
list is empty just return.
It can be useful for example if user selects 'add untracked' and there are no
untracked files, "Add untracked>>" opens. But it does not make sense in this
case, because there are no untracked files.
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
git-add--interactive.perl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 94b988c..85b2fe7 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -519,6 +519,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};
@@ -729,6 +732,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";
}
--
2.3.0.rc1.247.gb53aa6f.dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-01-22 8:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-22 8:39 [PATCH] git-add--interactive: return from list_and_choose if there is zero candidates Alexander Kuleshov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).