From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 7 Dec 2020 20:57:07 +0300 From: "Vladimir D. Seleznev" To: ALT Linux Team development discussions Message-ID: <20201207175707.GC1074869@portlab> References: <20201127134431.3854941-1-vseleznv@altlinux.org> <20201207165809.GA13984@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201207165809.GA13984@altlinux.org> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [devel] [PATCH v4 1/2] Add diff exclude option for gear-rules X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2020 17:56:54 -0000 Archived-At: List-Archive: List-Post: 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 > > --- > > 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