From 00f12ddfa6a327114f7798b405be3f0567577ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1o=20Belica?= Date: Mon, 31 Jan 2022 14:38:14 +0100 Subject: [PATCH] Fix pattern with spaces for `git grep` --- tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks.py b/tasks.py index d71ac26..3df8428 100644 --- a/tasks.py +++ b/tasks.py @@ -173,7 +173,7 @@ def git_search(c, pattern): """ c.run("git fetch origin") c.run("git remote prune origin") - result = c.run(f"git branch --remote | grep -v \" -> \" | xargs git grep {pattern}", hide="out", echo=False) + result = c.run(f'git branch --remote | grep -v " -> " | xargs git grep "{pattern}"', hide="out", echo=False) matches = {} for line in result.stdout.splitlines(): @@ -184,4 +184,4 @@ def by_branches(item): return len(item[1]) for (file, match), branches in sorted(matches.items(), key=by_branches, reverse=True): print(file) print(match) - print(f"{len(branches)}:", ", ".join(branches)) + print(f"{len(branches)}:", ", ".join(branches), end="\n\n")