Skip to content
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

Merged
merged 3 commits into from
Oct 15, 2017
Merged

Improve ignore-io #671

merged 3 commits into from
Oct 15, 2017

Conversation

sambostock
Copy link
Contributor

This makes two improvements to git ignore-io:

  • Fixes a bug where git ignore-io -L omitted entries which did not start with a..z
  • Removes the arbitrary choice of 5 columns on git ignore-io -L, in favour of column's default

Iterating through `a..z` omits entries starting with other characters.
echo
first_character=${ignorable:0:1}
if [[ $first_character = $previous_first_character ]]; then
printf " $ignorable"
Copy link
Collaborator

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.

@@ -8,16 +8,26 @@ update_gi_list() {
}

print_in_alphabetical_order() {
for i in {a..z};
first=true
Copy link
Collaborator

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.

@sambostock
Copy link
Contributor Author

@spacewander Thanks for the tips! Updated with those in mind.

@spacewander spacewander merged commit 7b76644 into tj:master Oct 15, 2017
@spacewander
Copy link
Collaborator

@sambostock
Merged. Thanks!

@sambostock sambostock deleted the improve-ignore-io branch October 15, 2017 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants