sparse-checkout: extract add_patterns_from_input()