Skip to content

Commit

Permalink
Fix pattern with spaces for git grep
Browse files Browse the repository at this point in the history
  • Loading branch information
miso-belica authored Jan 31, 2022
1 parent 09f8007 commit 00f12dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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")

0 comments on commit 00f12dd

Please sign in to comment.