unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Fix author-scan.sh on BSD systems.
@ 2021-02-13 18:22 Matt Armstrong
  2021-08-03 20:35 ` Tomi Ollila
  2021-08-04  1:47 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Armstrong @ 2021-02-13 18:22 UTC (permalink / raw)
  To: notmuch; +Cc: Matt Armstrong

BSD xargs does not have the -d option. Here we use tr to convert
newlines to NUL characters, then pass -0 to xargs (which BSD does
support).

I looked at passing -z to 'git ls-files', but I did not find a BSD
grep option to turn on NUL deliminted line processing.
---
 devel/author-scan.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/author-scan.sh b/devel/author-scan.sh
index 2d9c4af8..23854f39 100644
--- a/devel/author-scan.sh
+++ b/devel/author-scan.sh
@@ -5,7 +5,7 @@ AUTHOR_EXCLUDE='uncrustify'
 # based on the FSF guideline, for want of a better idea.
 THRESHOLD=15
 
-git ls-files | grep -v -e "$FILE_EXCLUDE" | xargs -n 1 -d \\n \
+git ls-files | grep -v -e "$FILE_EXCLUDE" | tr '\n' '\0' | xargs -0 -n 1 \
                                                   git blame -w --line-porcelain -- | \
     sed -n "/$AUTHOR_EXCLUDE/d; s/^[aA][uU][tT][hH][Oo][rR] //p" | \
     sort -fd | uniq -ic | awk "\$1 >= $THRESHOLD" | sort -nr
-- 
2.30.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix author-scan.sh on BSD systems.
  2021-02-13 18:22 [PATCH] Fix author-scan.sh on BSD systems Matt Armstrong
@ 2021-08-03 20:35 ` Tomi Ollila
  2021-08-04  1:47 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2021-08-03 20:35 UTC (permalink / raw)
  To: Matt Armstrong, notmuch

On Sat, Feb 13 2021, Matt Armstrong wrote:

> BSD xargs does not have the -d option. Here we use tr to convert
> newlines to NUL characters, then pass -0 to xargs (which BSD does
> support).
>
> I looked at passing -z to 'git ls-files', but I did not find a BSD
> grep option to turn on NUL deliminted line processing.
> ---
>  devel/author-scan.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/devel/author-scan.sh b/devel/author-scan.sh
> index 2d9c4af8..23854f39 100644
> --- a/devel/author-scan.sh
> +++ b/devel/author-scan.sh
> @@ -5,7 +5,7 @@ AUTHOR_EXCLUDE='uncrustify'
>  # based on the FSF guideline, for want of a better idea.
>  THRESHOLD=15
>  
> -git ls-files | grep -v -e "$FILE_EXCLUDE" | xargs -n 1 -d \\n \
> +git ls-files | grep -v -e "$FILE_EXCLUDE" | tr '\n' '\0' | xargs -0 -n 1 \

LGTM. David will know if this works for the task this is needed :D

Tomi

>                                                    git blame -w --line-porcelain -- | \
>      sed -n "/$AUTHOR_EXCLUDE/d; s/^[aA][uU][tT][hH][Oo][rR] //p" | \
>      sort -fd | uniq -ic | awk "\$1 >= $THRESHOLD" | sort -nr
> -- 
> 2.30.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix author-scan.sh on BSD systems.
  2021-02-13 18:22 [PATCH] Fix author-scan.sh on BSD systems Matt Armstrong
  2021-08-03 20:35 ` Tomi Ollila
@ 2021-08-04  1:47 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2021-08-04  1:47 UTC (permalink / raw)
  To: Matt Armstrong, notmuch; +Cc: Matt Armstrong

Matt Armstrong <matt@rfc20.org> writes:

> BSD xargs does not have the -d option. Here we use tr to convert
> newlines to NUL characters, then pass -0 to xargs (which BSD does
> support).
>
> I looked at passing -z to 'git ls-files', but I did not find a BSD
> grep option to turn on NUL deliminted line processing.

Applied to master.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-04  1:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-13 18:22 [PATCH] Fix author-scan.sh on BSD systems Matt Armstrong
2021-08-03 20:35 ` Tomi Ollila
2021-08-04  1:47 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).