[meld] filters: Rearrange the shell pattern split logic to be slightly clearer
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filters: Rearrange the shell pattern split logic to be slightly clearer
- Date: Sat, 27 Oct 2018 22:07:24 +0000 (UTC)
commit f2b9731aa3b23919605319855ab57e7582e0092a
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Oct 28 07:41:01 2018 +1000
filters: Rearrange the shell pattern split logic to be slightly clearer
meld/filters.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/meld/filters.py b/meld/filters.py
index 94fb5f46..0012bfa5 100644
--- a/meld/filters.py
+++ b/meld/filters.py
@@ -47,14 +47,14 @@ class FilterEntry:
@classmethod
def _compile_shell_pattern(cls, pattern):
bits = pattern.split()
- if len(bits) > 1:
+ if not bits:
+ # An empty pattern would match everything, so skip it
+ return None
+ elif len(bits) > 1:
regexes = [misc.shell_to_regex(b)[:-1] for b in bits]
regex = "(%s)$" % "|".join(regexes)
- elif len(bits):
- regex = misc.shell_to_regex(bits[0])
else:
- # An empty pattern would match everything, so skip it
- return None
+ regex = misc.shell_to_regex(bits[0])
try:
compiled = re.compile(regex)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]