Kaartic Sivaraam <[email protected]> writes:
> * He chooses to use 'git add -i' to stage changes
> * He chooses option 4, accidentally, instead of option 5. He is shown
> the following menu,
>
>> *** Commands ***
>> 1: status 2: update 3: revert 4: add
>> untracked
>> 5: patch 6: diff 7: quit 8: help
>> What now> 4
>> 1: test-file
>> Add untracked>>
>
> * He exits by hitting return but he is shown this weird message found
> below.
>
>> No untracked files.
>
> * He is surprised on seeing this.
>
> Why is that message shown when "there are untracked files" but the user
> doesn't add them to the staging area?
It comes from this snippet in git-add--interactive.perl:
sub add_untracked_cmd {
my @add = list_and_choose({ PROMPT => __('Add untracked') },
list_untracked());
if (@add) {
system(qw(git update-index --add --), @add);
say_n_paths('added', @add);
} else {
print __("No untracked files.\n");
}
print "\n";
}
After prompting to get the list of desired files, if the user chose
nothing, the message is shown. "No untracked files chosen." is
probably what the code wants to say, I would think.
git-add--interactive.perl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 709a5f6ce6..98c9f20578 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -711,7 +711,7 @@ sub add_untracked_cmd {
system(qw(git update-index --add --), @add);
say_n_paths('added', @add);
} else {
- print __("No untracked files.\n");
+ print __("No untracked file chosen.\n");
}
print "\n";
}