From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Alejandro Colomar <alx.manpages@gmail.com>
Cc: mtk.manpages@gmail.com, linux-man@vger.kernel.org
Subject: Re: [PATCH v2] Add script to get modified pages for commit msgs
Date: Mon, 16 Nov 2020 09:07:17 +0100 [thread overview]
Message-ID: <f3253576-63e6-1540-5a07-9b71a10c42e2@gmail.com> (raw)
In-Reply-To: <20201116001634.3663-1-alx.manpages@gmail.com>
On 11/16/20 1:16 AM, Alejandro Colomar wrote:
> The script can be used this way:
>
> git commit -sm "$(./scripts/modified_pages.sh): Short commit msg"
>
> And then maybe --ammend and add a longer message.
>
> This is especially useful for changes to many pages at once,
> usually when running a script to apply some global changes.
>
> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Hi Alex,
Can you resend with a copyright notice in the file.
Thanks,
Michael
> ---
>
> Now it will also include new files and deleted files.
>
> scripts/modified_pages.sh | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
> create mode 100755 scripts/modified_pages.sh
>
> diff --git a/scripts/modified_pages.sh b/scripts/modified_pages.sh
> new file mode 100755
> index 000000000..c6bc064a4
> --- /dev/null
> +++ b/scripts/modified_pages.sh
> @@ -0,0 +1,27 @@
> +#!/bin/bash
> +
> +## Usage:
> +## git commit -m "$(./scripts/modified_pages.sh): Short message here"
> +##
> +## How it works:
> +## 1) Read git status.
> +## 2) Staged changes are always before "Changes not staged for commit".
> +## Cut from that point to not include pages not staged for commit.
> +## 3) Keep only lines containing "modified:" or "deleted:" or "new file:"
> +## (each of those is a changed file)
> +## 4) Keep only the path, replacing git text by ", ".
> +## 5) Keep only the basenames of the files in 'man?/'.
> +## 6) Remove any newline characters.
> +## 7) Remove the comma before the first file
> +##
> +## The result is a list of all files with changes staged for commit,
> +## separated by ", ".
> +
> +
> +git status \
> +|sed "/Changes not staged for commit:/q" \
> +|grep -E "^\s*(modified|deleted|new file):" \
> +|sed "s/^.*:\s*/, /" \
> +|sed "s%man[1-9]/%%" \
> +|tr -d '\n' \
> +|sed "s/^, //"
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
next prev parent reply other threads:[~2020-11-16 8:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-15 23:08 [PATCH] Add script to get modified pages for commit msgs Alejandro Colomar
2020-11-16 0:16 ` [PATCH v2] " Alejandro Colomar
2020-11-16 0:46 ` Alejandro Colomar (man-pages)
2020-11-16 8:07 ` Michael Kerrisk (man-pages) [this message]
2020-11-16 19:42 ` Alejandro Colomar
2020-11-16 20:27 ` Michael Kerrisk (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f3253576-63e6-1540-5a07-9b71a10c42e2@gmail.com \
--to=mtk.manpages@gmail.com \
--cc=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox