-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve ignore-io #671
Improve ignore-io #671
Conversation
Iterating through `a..z` omits entries starting with other characters.
bin/git-ignore-io
Outdated
echo | ||
first_character=${ignorable:0:1} | ||
if [[ $first_character = $previous_first_character ]]; then | ||
printf " $ignorable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use printf " %s" "$ignoreable"
to avoid format string injection.
bin/git-ignore-io
Outdated
@@ -8,16 +8,26 @@ update_gi_list() { | |||
} | |||
|
|||
print_in_alphabetical_order() { | |||
for i in {a..z}; | |||
first=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, it is better to declare local first ignorable first_character previous_first_character
before using those variables in function, to avoid polluting outer variable scope.
@spacewander Thanks for the tips! Updated with those in mind. |
@sambostock |
This makes two improvements to
git ignore-io
:git ignore-io -L
omitted entries which did not start witha..z
git ignore-io -L
, in favour ofcolumn
's default