From f27eeaa2e84de306266dac1332638bc0ae452073 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 24 Jul 2022 17:27:21 -0700 Subject: black: add .git-blame-ignore-revs toignore black reformatting in blame - [x] add `.git-blame-ignore-revs` to ignore black reformatting - [x] make `spack blame` respect `.git-blame-ignore-revs` (even if the user hasn't configured git to do so) --- lib/spack/spack/cmd/blame.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/blame.py b/lib/spack/spack/cmd/blame.py index 23ac147580..aeedbe72d4 100644 --- a/lib/spack/spack/cmd/blame.py +++ b/lib/spack/spack/cmd/blame.py @@ -131,11 +131,21 @@ def blame(parser, args): # get git blame for the package with working_dir(spack.paths.prefix): + # ignore the great black reformatting of 2022 + ignore_file = os.path.join(spack.paths.prefix, ".git-blame-ignore-revs") + if args.view == "git": - git("blame", blame_file) + git("blame", "--ignore-revs-file", ignore_file, blame_file) return else: - output = git("blame", "--line-porcelain", blame_file, output=str) + output = git( + "blame", + "--line-porcelain", + "--ignore-revs-file", + ignore_file, + blame_file, + output=str, + ) lines = output.split("\n") # Histogram authors -- cgit v1.2.3-60-g2f50