diff options
author | Beat Bolli <bb@drbeat.li> | 2024-03-15 20:45:58 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-16 11:08:55 -0700 |
commit | 938e891a9aa6626a948bb507f2f6b215be5bb6a3 (patch) | |
tree | 9bc666838c92f8b5c66d122ff5ab0000880d3b19 /Documentation/howto | |
parent | 2953d95d402b6bff1a59c4712f4d46f1b9ea137f (diff) | |
download | git-938e891a9aa6626a948bb507f2f6b215be5bb6a3.tar.gz |
doc: avoid redundant use of cat
The update-hook-example.txt script uses this anti-pattern twice. Call grep
with the input file name directy. While at it, merge the two consecutive
grep calls.
Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/howto')
-rw-r--r-- | Documentation/howto/update-hook-example.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Documentation/howto/update-hook-example.txt b/Documentation/howto/update-hook-example.txt index 151ee84ceb..4e727deedd 100644 --- a/Documentation/howto/update-hook-example.txt +++ b/Documentation/howto/update-hook-example.txt @@ -100,7 +100,7 @@ info "The user is: '$username'" if test -f "$allowed_users_file" then - rc=$(cat $allowed_users_file | grep -v '^#' | grep -v '^$' | + rc=$(grep -Ev '^(#|$)' $allowed_users_file | while read heads user_patterns do # does this rule apply to us? @@ -138,7 +138,7 @@ info "'$groups'" if test -f "$allowed_groups_file" then - rc=$(cat $allowed_groups_file | grep -v '^#' | grep -v '^$' | + rc=$(grep -Ev '^(#|$)' $allowed_groups_file | while read heads group_patterns do # does this rule apply to us? |