diff --git a/git-secrets b/git-secrets index 3340cb1..1a0bb6b 100755 --- a/git-secrets +++ b/git-secrets @@ -11,7 +11,7 @@ # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either # express or implied. See the License for the specific language governing # permissions and limitations under the License. -VERSION=1.4.1 +VERSION=1.5.0 NONGIT_OK=1 OPTIONS_SPEC="\ git secrets --scan [-r|--recursive] [--cached] [--no-index] [--untracked] [...] @@ -119,10 +119,13 @@ scan_history() { # Note: this function returns 1 on success, 0 on error. git_grep() { local options="$1"; shift - local files=("${@}") combined_patterns=$(load_combined_patterns) + local files=("${@}") patterns=$(load_patterns) - [ -z "${combined_patterns}" ] && return 1 - GREP_OPTIONS= LC_ALL=C git grep -nwHEI ${options} "${combined_patterns}" -- "${files[@]}" + [ -z "${patterns}" ] && return 1 + # Pass patterns one per line rather than as a single alternation: git's + # regex engine slows down sharply as one alternation grows. + printf '%s\n' "${patterns}" \ + | GREP_OPTIONS= LC_ALL=C git grep -nwHEI ${options} -f - -- "${files[@]}" } # Performs a regular grep, taking into account patterns and recursion.