ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Gladkov <legion@altlinux.ru>
To: "Vladimir D. Seleznev" <vseleznv@altlinux.org>
Cc: devel@lists.altlinux.org, ldv@altlinux.org
Subject: Re: [devel] [PATCH 1/3] Introduce nodiff directive for gear-rules
Date: Thu, 26 Nov 2020 15:49:27 +0100
Message-ID: <20201126144927.h36zzrisholvca3s@example.org> (raw)
In-Reply-To: <20201126141636.2742206-1-vseleznv@altlinux.org>

On Thu, Nov 26, 2020 at 05:16:34PM +0300, Vladimir D. Seleznev wrote:
> The directive specifies a glob pattern that define files that should be
> excluded from diff generation.

Мои комментарии относятся только к технической части. Относительно
именования директив и нужности директивы вообще должен Дима высказаться.

Лично мне не нравится, что опция для директивы diff сделана директивой.
Это выглядит хаком. У вас аргумент nodiff не может иметь пробелы. В этом
случае несложно сделать `diff: exclude=glob_pattern`.

> Signed-off-by: Vladimir D. Seleznev <vseleznv@altlinux.org>
> ---
>  gear            | 24 ++++++++++++++++++------
>  gear-rules.5.in | 19 +++++++++++++++++++
>  gear-store-tags |  2 +-
>  3 files changed, 38 insertions(+), 7 deletions(-)
> 
> diff --git a/gear b/gear
> index 6282c92..b4e8426 100755
> --- a/gear
> +++ b/gear
> @@ -402,13 +402,14 @@ write_git_diff()
>  {
>  	local optional="$1" && shift
>  	local cmd="$1" && shift
> +	local nodiff_patterns="$1" && shift
>  	local old_tree="$1" && shift
>  	local old_dir="$1" && shift
>  	local new_tree="$1" && shift
>  	local new_dir="$1" && shift
>  	local name="${1##*/}" && shift
>  
> -	local old_id new_id
> +	local old_id new_id nodiff=
>  
>  	old_id="$(traverse_tree "$old_tree" "$old_dir" "$optional")" ||
>  		{
> @@ -422,8 +423,13 @@ write_git_diff()
>  				exit 1
>  		}
>  
> +	for pattern in $nodiff_patterns; do
> +		[ -n "$pattern" ] ||continue

В остальном коде после '||' всегда ставится пробел если за ним идёт другая
команда.

> +		nodiff="$nodiff $(printf ":^%s" "$pattern")"

subshell для подстановки $pattern c двумя символами выглядит странно.
Наверно лучше написать:

nodiff="$nodiff :^$pattern"

-- 
Rgrds, legion



  parent reply	other threads:[~2020-11-26 14:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 14:16 Vladimir D. Seleznev
2020-11-26 14:16 ` [devel] [PATCH 2/3] tests: add test for nodiff directive Vladimir D. Seleznev
2020-11-26 14:16 ` [devel] [PATCH 3/3] tests: check nodiff does not fail if pattern matches no file Vladimir D. Seleznev
2020-11-26 14:49 ` Alexey Gladkov [this message]
2020-11-26 14:54   ` [devel] [PATCH 1/3] Introduce nodiff directive for gear-rules Vladimir D. Seleznev
2020-11-26 15:17     ` Alexey Gladkov
2020-11-26 15:20       ` Anton Farygin
2020-11-26 15:51       ` Alexey Gladkov
2020-12-09  2:10         ` Dmitry V. Levin
2020-12-09 10:40           ` Alexey Gladkov
2020-12-09 14:39             ` [devel] gear-rules: allow backslashes to escape any characters Dmitry V. Levin
2020-12-09 14:48               ` Vladimir D. Seleznev
2020-12-09 15:51               ` Alexey Gladkov
2020-12-10 10:31                 ` Dmitry V. Levin

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=20201126144927.h36zzrisholvca3s@example.org \
    --to=legion@altlinux.ru \
    --cc=devel@lists.altlinux.org \
    --cc=ldv@altlinux.org \
    --cc=vseleznv@altlinux.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

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git