[devel] [PATCH v4 1/2] Add diff exclude option for gear-rules
Vladimir D. Seleznev
vseleznv на altlinux.org
Пн Дек 7 20:57:07 MSK 2020
On Mon, Dec 07, 2020 at 07:58:09PM +0300, Dmitry V. Levin wrote:
> On Fri, Nov 27, 2020 at 04:44:30PM +0300, Vladimir D. Seleznev wrote:
> > The option specifies a glob pattern that define files that should be
>
> pattern that defineS
>
> > excluded from diff generation.
> >
> > Signed-off-by: Vladimir D. Seleznev <vseleznv на altlinux.org>
> > ---
> > gear | 17 +++++++++++++----
> > gear-rules.5.in | 19 +++++++++++++++++++
> > gear-store-tags | 4 ++++
> > 3 files changed, 36 insertions(+), 4 deletions(-)
> >
> > diff --git a/gear b/gear
> > index 6282c92..7bdddc0 100755
> > --- a/gear
> > +++ b/gear
> > @@ -337,7 +337,7 @@ make_archive()
> > write_git_archive "$format" "$optional" "$cmd" "$tar_tree" "$dir_name" "$tar_name" "$tar_base" "$tar_suffix"
> > }
> >
> > -get_diff_name()
> > +get_diff_opts()
> > {
> > local old_d="$1" && shift
> > local new_d="$1" && shift
>
> OK
>
> > @@ -376,6 +376,13 @@ get_diff_name()
> > ;;
> > name=*) diff_name="${opt#name=}"
> > ;;
> > + exclude=*)
> > + [ -z "$(printf %s "${opt#exclude=}" |tr -d '[:alnum:]_.?*-/![]')" ] ||
> > + rules_error "Invalid diff exclude pattern specified: ${opt#exclude=}"
>
> Why '[:alnum:]_.?*-/![]' ?
>
> > + [ -n "${opt#exclude=}" ] ||
> > + rules_error "Invalid diff exclude pattern specified: empty pattern"
> > + diff_exclude="$diff_exclude :^${opt#exclude=}"
> > + ;;
>
> You're doing this ${opt#exclude=} thing 4 times,
> I suggest saving the result to a variable and using it afterwards.
https://lists.altlinux.org/pipermail/devel/2020-November/212766.html
On Fri, Nov 27, 2020 at 02:28:08PM +0100, Alexey Gladkov wrote:
> Здесь и в gear-store-tags не требуется заводить новую переменную только
> для того чтобы переложить $opt без префикса в $diff_exclude.
>
> С другими опциями это оправдано так как значения этих опций используются
> в функции ниже.
>
> Предлагаю написать просто: opt="${opt#exclude=}"
--
WBR,
Vladimir D. Seleznev
Подробная информация о списке рассылки Devel