Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 4 May 2022 16:06:44 +1000
From: Patrick Oppenlander <patrick.oppenlander@...il.com>
To: musl@...ts.openwall.com
Cc: Jules Maselbas <jmaselbas@...ray.eu>
Subject: Re: [PATCH 1/2] tools: Add a script to remove trailing spaces

On Wed, May 4, 2022 at 1:57 AM Jules Maselbas <jmaselbas@...ray.eu> wrote:
>
> Add the remove-trailing-space.sh script, it will only consider files
> tracked by git. Optionaly accept arguments to select the affected path.
>
> Signed-off-by: Jules Maselbas <jmaselbas@...ray.eu>
> ---
>  tools/remove-trailing-space.sh | 2 ++
>  1 file changed, 2 insertions(+)
>  create mode 100755 tools/remove-trailing-space.sh
>
> diff --git a/tools/remove-trailing-space.sh b/tools/remove-trailing-space.sh
> new file mode 100755
> index 00000000..a8b0056a
> --- /dev/null
> +++ b/tools/remove-trailing-space.sh
> @@ -0,0 +1,2 @@
> +#!/bin/sh
> +git grep  '[[:space:]]$' -- $@ | sed 's/:.*//' | uniq | xargs sed -i 's/[[:space:]]\+$//'

There's a --name-only option you can give to git grep, so I think you
can simplify this to:

git grep --name-only '[[:space:]]$' | xargs sed -i 's/[[:space:]]\+$//'

Patrick

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.