Skip to content

Commit 2dffbec

Browse files
authored
git: add .gitattributes file (spack#13947)
Add a line to .gitattributes so that `git grep -p` shows function names properly for `*.py` files. Without this, the class name is shown instead of the function for python files. This also causes diff output to use proper functions as hunk headers in `diff` output. Here's an example with `git grep -p`. Before: $ git grep -p spack_cc var/spack/repos/builtin/packages/athena var/spack/repos/builtin/packages/athena/package.py=class Athena(AutotoolsPackage): var/spack/repos/builtin/packages/athena/package.py: env.set('CC', spack_cc) var/spack/repos/builtin/packages/athena/package.py: env.set('LDR', spack_cc) After: $ git grep -p spack_cc var/spack/repos/builtin/packages/athena var/spack/repos/builtin/packages/athena/package.py= def setup_build_environment(self, env): var/spack/repos/builtin/packages/athena/package.py: env.set('CC', spack_cc) var/spack/repos/builtin/packages/athena/package.py: env.set('LDR', spack_cc) Here's an example with `diff`. Before: $ git show c5da94e [...] @@ -28,6 +29,7 @@ print(u'\\xc3') # make it executable fs.set_executable(script_name) + filter_shebangs_in_directory('.', [script_name]) # read the unicode back in and see whether things work script = ex.Executable('./%s' % script_name) After: $ git show c5da94e [...] @@ -28,6 +29,7 @@ def test_read_unicode(tmpdir): # make it executable fs.set_executable(script_name) + filter_shebangs_in_directory('.', [script_name]) # read the unicode back in and see whether things work script = ex.Executable('./%s' % script_name)
1 parent 8e3ff9b commit 2dffbec

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.py diff=python

0 commit comments

Comments
 (0)