Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions git-secrets
Original file line number Diff line number Diff line change
Expand Up @@ -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] [<files>...]
Expand Down Expand Up @@ -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.
Expand Down
Loading